From 99edca083cb44018eeb6b9f1f08812752076d179 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Wed, 20 Jan 2010 20:34:03 +0000 Subject: [PATCH] Made more improvents to multi-path-node editing git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1252 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 61 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 9b4f65aa..84bc1644 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -3240,6 +3240,7 @@ function BatchCommand(text) { var current_ctrl_pt_drag = -1; var link_control_pts = false; var selected_pts = []; + var hasMoved = false; var resetPointGrips = function() { if(!current_path) return; @@ -3315,7 +3316,7 @@ function BatchCommand(text) { for(var i=0; i< points.length; i++) { var pt = points[i]; - if($.inArray(pt, selected_pts) == -1) { + if($.inArray(pt, selected_pts) == -1 && pt >= 0) { selected_pts.push(pt); } } @@ -3338,9 +3339,10 @@ function BatchCommand(text) { $('#ctrlpointgrip_' + point + 'c1, #ctrlpointgrip_' + point + 'c2').attr('fill','#0FF'); } - if(current_path_pt == -1) { + if(selected_pts.length <= 1) {//if(current_path_pt == -1) { current_path_pt = selected_pts[0]; } + updateSegLine(); updateSegLine(true); @@ -3375,6 +3377,7 @@ function BatchCommand(text) { $('#pathpointgrip_container circle').attr('stroke','#EEE'); $('#ctrlpointgrip_container circle').attr('fill', '#EEE'); selected_pts = []; +// current_path_pt = -1; // call("selected", []); }; @@ -3492,6 +3495,11 @@ function BatchCommand(text) { }); segLine = pointGripContainer.appendChild(segLine); } + if(selected_pts.length != 1) { + segLine.setAttribute('display','none'); + return; + } + if(!segLine.getAttribute('d')) { var pt = getPathPoint(current_path_pt); segLine.setAttribute('d', 'M' + pt.join(',') + ' 0,0'); @@ -3965,34 +3973,6 @@ function BatchCommand(text) { 'height': 0, 'display': 'inline' }, 100); - - - // if we haven't moused down on a shape, then go into multiselect mode - // otherwise, select it -// console.log('clear!') -// canvas.clearSelection(); -// if (mouse_target.id != "svgroot") { -// current_path = null; -// canvas.addToSelection([mouse_target], true); -// canvas.setMode("select"); -// -// // Insert the dummy transform here in case element is moved -// var tlist = canvas.getTransformList(mouse_target); -// tlist.insertItemBefore(svgroot.createSVGTransform(), 0); -// } -// else { -// canvas.setMode("multiselect"); -// if (rubberBox == null) { -// rubberBox = selectorManager.getRubberBandBox(); -// } -// assignAttributes(rubberBox, { -// 'x': start_x, -// 'y': start_y, -// 'width': 0, -// 'height': 0, -// 'display': 'inline' -// }, 100); -// } } }, mouseMove: function(mouse_x, mouse_y) { @@ -4012,6 +3992,11 @@ function BatchCommand(text) { var diff_x = mouse_x - current_path_pts[current_path_pt*2]; var diff_y = mouse_y - current_path_pts[current_path_pt*2+1]; +// var rot = !!canvas.getRotationAngle(current_path); +// if(rot) { +// var m = canvas.getTransformList(current_path).getItem(0).matrix; +// } + for(var i=0; i