Fixed issue 432
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1271 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
86ac38547f
commit
3df4a5d616
|
@ -141,7 +141,7 @@ function svg_edit_setup() {
|
||||||
svgCanvas.setMode('select');
|
svgCanvas.setMode('select');
|
||||||
};
|
};
|
||||||
|
|
||||||
var togglePathEditMode = function(editmode) {
|
var togglePathEditMode = function(editmode, elems) {
|
||||||
$('#path_node_panel').toggle(editmode);
|
$('#path_node_panel').toggle(editmode);
|
||||||
$('#tools_bottom_2,#tools_bottom_3').toggle(!editmode);
|
$('#tools_bottom_2,#tools_bottom_3').toggle(!editmode);
|
||||||
var size = $('#tool_select > svg, #tool_select > img')[0].getAttribute('width');
|
var size = $('#tool_select > svg, #tool_select > img')[0].getAttribute('width');
|
||||||
|
@ -151,6 +151,9 @@ function svg_edit_setup() {
|
||||||
$('#tool_select').addClass('tool_button_current')
|
$('#tool_select').addClass('tool_button_current')
|
||||||
.empty().append($.getSvgIcon('select_node'));
|
.empty().append($.getSvgIcon('select_node'));
|
||||||
multiselected = false;
|
multiselected = false;
|
||||||
|
if(elems.length) {
|
||||||
|
selectedElement = elems[0];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#tool_select').empty().append($.getSvgIcon('select'));
|
$('#tool_select').empty().append($.getSvgIcon('select'));
|
||||||
}
|
}
|
||||||
|
@ -198,7 +201,8 @@ function svg_edit_setup() {
|
||||||
} // if (elem != null)
|
} // if (elem != null)
|
||||||
|
|
||||||
// Deal with pathedit mode
|
// Deal with pathedit mode
|
||||||
togglePathEditMode(is_node);
|
togglePathEditMode(is_node, elems);
|
||||||
|
|
||||||
|
|
||||||
updateContextPanel();
|
updateContextPanel();
|
||||||
};
|
};
|
||||||
|
@ -401,6 +405,7 @@ function svg_edit_setup() {
|
||||||
$('#tool_reorient').toggleClass('tool_button_disabled', angle == 0);
|
$('#tool_reorient').toggleClass('tool_button_disabled', angle == 0);
|
||||||
} else {
|
} else {
|
||||||
var point = path.getNodePoint();
|
var point = path.getNodePoint();
|
||||||
|
$('#tool_node_delete').toggleClass('tool_button_disabled', !path.canDeleteNodes);
|
||||||
if(point) {
|
if(point) {
|
||||||
var seg_type = $('#seg_type');
|
var seg_type = $('#seg_type');
|
||||||
$('#path_node_x').val(point.x);
|
$('#path_node_x').val(point.x);
|
||||||
|
|
|
@ -3336,6 +3336,8 @@ function BatchCommand(text) {
|
||||||
//
|
//
|
||||||
var addNodeToSelection = function(points) {
|
var addNodeToSelection = function(points) {
|
||||||
// var point = points;
|
// var point = points;
|
||||||
|
|
||||||
|
|
||||||
if(!$.isArray(points)) points = [points];
|
if(!$.isArray(points)) points = [points];
|
||||||
|
|
||||||
for(var i=0; i< points.length; i++) {
|
for(var i=0; i< points.length; i++) {
|
||||||
|
@ -3351,6 +3353,10 @@ function BatchCommand(text) {
|
||||||
last_pt = current_path_pts.length/2 - 1,
|
last_pt = current_path_pts.length/2 - 1,
|
||||||
grips = new Array(i);
|
grips = new Array(i);
|
||||||
|
|
||||||
|
// Check if amount of selected nodes are allowed to be deleted
|
||||||
|
var tot_pts = current_path_pts.length/2 - (is_closed?1:0);
|
||||||
|
pathActions.canDeleteNodes = (tot_pts - i >= 2);
|
||||||
|
|
||||||
$('#pathpointgrip_container circle').attr('stroke','#00F');
|
$('#pathpointgrip_container circle').attr('stroke','#00F');
|
||||||
|
|
||||||
// Loop through points to be selected and highlight each
|
// Loop through points to be selected and highlight each
|
||||||
|
@ -3391,6 +3397,7 @@ function BatchCommand(text) {
|
||||||
updateSegLine();
|
updateSegLine();
|
||||||
updateSegLine(true);
|
updateSegLine(true);
|
||||||
|
|
||||||
|
// TODO: Set grips
|
||||||
// call("selected", grips);
|
// call("selected", grips);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4017,17 +4024,24 @@ function BatchCommand(text) {
|
||||||
var diff_x = mouse_x - current_path_pts[current_path_pt*2];
|
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 diff_y = mouse_y - current_path_pts[current_path_pt*2+1];
|
||||||
|
|
||||||
// var rot = !!canvas.getRotationAngle(current_path);
|
var rot = !!canvas.getRotationAngle(current_path);
|
||||||
// if(rot) {
|
if(rot) {
|
||||||
// var m = canvas.getTransformList(current_path).getItem(0).matrix;
|
var m = canvas.getTransformList(current_path).getItem(0).matrix;
|
||||||
// }
|
}
|
||||||
|
|
||||||
for(var i=0; i<selected_pts.length; i++) {
|
for(var i=0; i<selected_pts.length; i++) {
|
||||||
var sel_pt = selected_pts[i];
|
var sel_pt = selected_pts[i];
|
||||||
|
|
||||||
var sel_pt_x = current_path_pts[sel_pt*2] + diff_x;
|
var sel_pt_x = current_path_pts[sel_pt*2] + diff_x;
|
||||||
var sel_pt_y = current_path_pts[sel_pt*2+1] + diff_y;
|
var sel_pt_y = current_path_pts[sel_pt*2+1] + diff_y;
|
||||||
//
|
|
||||||
|
if(rot) {
|
||||||
|
// var pt = transformPoint(current_path_pts[sel_pt*2], current_path_pts[sel_pt*2+1], m);
|
||||||
|
// var dpt = transformPoint(diff_x, diff_y, m);
|
||||||
|
// sel_pt_x = pt.x + dpt.x;
|
||||||
|
// sel_pt_y = pt.y + dpt.y;
|
||||||
|
}
|
||||||
|
|
||||||
current_path_pt_drag = sel_pt;
|
current_path_pt_drag = sel_pt;
|
||||||
updatePath(sel_pt_x, sel_pt_y, old_path_pts);
|
updatePath(sel_pt_x, sel_pt_y, old_path_pts);
|
||||||
}
|
}
|
||||||
|
@ -4487,14 +4501,13 @@ function BatchCommand(text) {
|
||||||
// current_path.setAttribute("d", convertToD(current_path.pathSegList));
|
// current_path.setAttribute("d", convertToD(current_path.pathSegList));
|
||||||
},
|
},
|
||||||
deletePathNode: function() {
|
deletePathNode: function() {
|
||||||
|
if(!pathActions.canDeleteNodes) return;
|
||||||
var is_closed = pathIsClosed();
|
var is_closed = pathIsClosed();
|
||||||
|
|
||||||
// TODO: Make delete node button disabled when there's only 2 nodes
|
var len = selected_pts.length;
|
||||||
if(current_path_pts.length <= (is_closed?6:4)) return;
|
|
||||||
|
|
||||||
var d = getD();
|
var d = getD();
|
||||||
|
|
||||||
var len = selected_pts.length;
|
|
||||||
while(len--) {
|
while(len--) {
|
||||||
var pt = selected_pts[len];
|
var pt = selected_pts[len];
|
||||||
var last_pt = current_path_pts.length/2 - 1;
|
var last_pt = current_path_pts.length/2 - 1;
|
||||||
|
|
Loading…
Reference in New Issue