diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 34365832..01d45b9c 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -1425,6 +1425,7 @@ function BatchCommand(text) { this.addNodeToSelection = function(point) { // Currently only one node can be selected at a time, should allow more later // Should point be the index or the grip element? + var is_closed = current_poly.getAttribute('d').toLowerCase().indexOf('z') != -1; if(is_closed && point == current_poly_pts.length/2 - 1) { @@ -1433,8 +1434,11 @@ function BatchCommand(text) { current_poly_pt = point; } - $('#polypointgrip_container circle').attr('fill','#0F0'); - var grip = $('#polypointgrip_' + point).attr('fill','blue'); + $('#polypointgrip_container circle').attr('stroke','#00F'); + var grip = $('#polypointgrip_' + point).attr('stroke','#0FF'); + updateSegLine(); + updateSegLine(true); + call("selected", [grip[0]]); } @@ -1696,6 +1700,7 @@ function BatchCommand(text) { // Select this point current_poly_pt_drag = parseInt(id.substr(14)); canvas.addNodeToSelection(current_poly_pt_drag); + updateSegLine(); } else if(id.indexOf("ctrlpointgrip_") == 0) { current_ctrl_pt_drag = id.split('_')[1]; } @@ -2033,7 +2038,9 @@ function BatchCommand(text) { c_item['x' + ctrl_num] = x; c_item['y' + ctrl_num] = y; replacePathSeg(6, index+1, [c_item.x,c_item.y, c_item.x1,c_item.y1, c_item.x2,c_item.y2]); - + + updateSegLine(true); + var grip = document.getElementById("ctrlpointgrip_" + current_ctrl_pt_drag); if(grip) { grip.setAttribute("cx", mouse_x); @@ -2183,7 +2190,7 @@ function BatchCommand(text) { 'id': "polypointgrip_" + index, 'display': "none", 'r': 4, - 'fill': "#0F0", + 'fill': "#0FF", 'stroke': "#00F", 'stroke-width': 2, 'cursor': 'move', @@ -2192,14 +2199,11 @@ function BatchCommand(text) { pointGrip = pointGripContainer.appendChild(pointGrip); var grip = $('#polypointgrip_'+index); -// grip.mouseover( function() { this.setAttribute("stroke", "#F00"); } ); -// grip.mouseout( function() {this.setAttribute("stroke", "#00F"); } ); - grip.dblclick( function() { - + grip.dblclick(function() { canvas.setSegType(); }); } - + // set up the point grip element and display it assignAttributes(pointGrip, { 'cx': x, @@ -2208,27 +2212,40 @@ function BatchCommand(text) { }); }; - // Hack for Webktit to change the segment list from absolute values - // back to relative values. Probably inefficient, so not currently used -// var fixWebkitNodes = function() { -// var list = current_poly.pathSegList; -// var pts = current_poly_pts; -// var num = list.numberOfItems; -// for(var i = 0; i