cleaned up objects with too many commas, made some optimizations which prevent icon elems from being included in ID numbers
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1133 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
b3d993959b
commit
525dbf0c18
|
@ -112,11 +112,11 @@ $.jGraduate = {
|
||||||
jQuery.fn.jGraduateDefaults = {
|
jQuery.fn.jGraduateDefaults = {
|
||||||
paint: new $.jGraduate.Paint(),
|
paint: new $.jGraduate.Paint(),
|
||||||
window: {
|
window: {
|
||||||
pickerTitle: "Drag markers to pick a paint",
|
pickerTitle: "Drag markers to pick a paint"
|
||||||
},
|
},
|
||||||
images: {
|
images: {
|
||||||
clientPath: "images/",
|
clientPath: "images/"
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.fn.jGraduate =
|
jQuery.fn.jGraduate =
|
||||||
|
@ -147,7 +147,7 @@ jQuery.fn.jGraduate =
|
||||||
// make a copy of the incoming paint
|
// make a copy of the incoming paint
|
||||||
paint: new $.jGraduate.Paint({copy: $settings.paint}),
|
paint: new $.jGraduate.Paint({copy: $settings.paint}),
|
||||||
okCallback: $.isFunction($arguments[1]) && $arguments[1] || null,
|
okCallback: $.isFunction($arguments[1]) && $arguments[1] || null,
|
||||||
cancelCallback: $.isFunction($arguments[2]) && $arguments[2] || null,
|
cancelCallback: $.isFunction($arguments[2]) && $arguments[2] || null
|
||||||
});
|
});
|
||||||
|
|
||||||
var pos = $this.position(),
|
var pos = $this.position(),
|
||||||
|
|
|
@ -84,7 +84,7 @@ $.fn.SpinButton = function(cfg){
|
||||||
_direction: null,
|
_direction: null,
|
||||||
_delay: null,
|
_delay: null,
|
||||||
_repeat: null,
|
_repeat: null,
|
||||||
callback: cfg && cfg.callback ? cfg.callback : null,
|
callback: cfg && cfg.callback ? cfg.callback : null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ function svg_edit_setup() {
|
||||||
'font-size': {s: '.9em', l: '2em', xl: '2.5em'}
|
'font-size': {s: '.9em', l: '2em', xl: '2.5em'}
|
||||||
},
|
},
|
||||||
"#zoom_panel": {
|
"#zoom_panel": {
|
||||||
'margin-top': {s: '3px', l: '4px', xl: '5px'},
|
'margin-top': {s: '3px', l: '4px', xl: '5px'}
|
||||||
},
|
},
|
||||||
"#copyright, #tools_bottom .label": {
|
"#copyright, #tools_bottom .label": {
|
||||||
'font-size': {l: '1.5em', xl: '2em'},
|
'font-size': {l: '1.5em', xl: '2em'},
|
||||||
|
@ -1292,7 +1292,7 @@ function svg_edit_setup() {
|
||||||
},
|
},
|
||||||
"#sidepanels": {
|
"#sidepanels": {
|
||||||
'top': {s: '50px', l: '88px', xl: '125px'},
|
'top': {s: '50px', l: '88px', xl: '125px'},
|
||||||
'bottom': {s: '51px', l: '68px', xl: '65px'},
|
'bottom': {s: '51px', l: '68px', xl: '65px'}
|
||||||
},
|
},
|
||||||
'#layerbuttons': {
|
'#layerbuttons': {
|
||||||
'width': {l: '130px', xl: '175px'},
|
'width': {l: '130px', xl: '175px'},
|
||||||
|
@ -1519,7 +1519,7 @@ function svg_edit_setup() {
|
||||||
{
|
{
|
||||||
paint: paint,
|
paint: paint,
|
||||||
window: { pickerTitle: title },
|
window: { pickerTitle: title },
|
||||||
images: { clientPath: "jgraduate/images/" },
|
images: { clientPath: "jgraduate/images/" }
|
||||||
},
|
},
|
||||||
function(p) {
|
function(p) {
|
||||||
paint = new $.jGraduate.Paint(p);
|
paint = new $.jGraduate.Paint(p);
|
||||||
|
|
|
@ -83,6 +83,7 @@ var fromXml = function(str) {
|
||||||
return $('<p/>').html(str).text();
|
return $('<p/>').html(str).text();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// These command objects are used for the Undo/Redo stack
|
// These command objects are used for the Undo/Redo stack
|
||||||
// attrs contains the values that the attributes had before the change
|
// attrs contains the values that the attributes had before the change
|
||||||
function ChangeElementCommand(elem, attrs, text) {
|
function ChangeElementCommand(elem, attrs, text) {
|
||||||
|
@ -502,7 +503,7 @@ function BatchCommand(text) {
|
||||||
n: [nbax + (nbaw)/2, nbay],
|
n: [nbax + (nbaw)/2, nbay],
|
||||||
w: [nbax, nbay + (nbah)/2],
|
w: [nbax, nbay + (nbah)/2],
|
||||||
e: [nbax + nbaw, nbay + (nbah)/2],
|
e: [nbax + nbaw, nbay + (nbah)/2],
|
||||||
s: [nbax + (nbaw)/2, nbay + nbah],
|
s: [nbax + (nbaw)/2, nbay + nbah]
|
||||||
};
|
};
|
||||||
|
|
||||||
if(selected == selectedElements[0]) {
|
if(selected == selectedElements[0]) {
|
||||||
|
@ -830,7 +831,7 @@ function BatchCommand(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateElementFromJson = function(data) {
|
this.updateElementFromJson = function(data) {
|
||||||
var shape = svgdoc.getElementById(data.attr.id);
|
var shape = getElem(data.attr.id);
|
||||||
// if shape is a path but we need to create a rect/ellipse, then remove the path
|
// if shape is a path but we need to create a rect/ellipse, then remove the path
|
||||||
if (shape && data.element != shape.tagName) {
|
if (shape && data.element != shape.tagName) {
|
||||||
current_layer.removeChild(shape);
|
current_layer.removeChild(shape);
|
||||||
|
@ -869,6 +870,8 @@ function BatchCommand(text) {
|
||||||
svgcontent.setAttribute("xmlns:xlink", xlinkns);
|
svgcontent.setAttribute("xmlns:xlink", xlinkns);
|
||||||
svgroot.appendChild(svgcontent);
|
svgroot.appendChild(svgcontent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// TODO: make this string optional and set by the client
|
// TODO: make this string optional and set by the client
|
||||||
var comment = svgdoc.createComment(" Created with SVG-edit - http://svg-edit.googlecode.com/ ");
|
var comment = svgdoc.createComment(" Created with SVG-edit - http://svg-edit.googlecode.com/ ");
|
||||||
|
@ -922,13 +925,6 @@ function BatchCommand(text) {
|
||||||
var cur_text = all_properties.text;
|
var cur_text = all_properties.text;
|
||||||
var cur_properties = cur_shape;
|
var cur_properties = cur_shape;
|
||||||
|
|
||||||
var freehand = {
|
|
||||||
minx: null,
|
|
||||||
miny: null,
|
|
||||||
maxx: null,
|
|
||||||
maxy: null
|
|
||||||
};
|
|
||||||
|
|
||||||
var current_zoom = 1;
|
var current_zoom = 1;
|
||||||
// this will hold all the currently selected elements
|
// this will hold all the currently selected elements
|
||||||
// default size of 1 until it needs to grow bigger
|
// default size of 1 until it needs to grow bigger
|
||||||
|
@ -1014,7 +1010,8 @@ function BatchCommand(text) {
|
||||||
var getNextId = function() {
|
var getNextId = function() {
|
||||||
// ensure the ID does not exist
|
// ensure the ID does not exist
|
||||||
var id = getId();
|
var id = getId();
|
||||||
while (svgdoc.getElementById(id)) {
|
|
||||||
|
while (getElem(id)) {
|
||||||
obj_num++;
|
obj_num++;
|
||||||
id = getId();
|
id = getId();
|
||||||
}
|
}
|
||||||
|
@ -2283,6 +2280,12 @@ function BatchCommand(text) {
|
||||||
var start_x = null;
|
var start_x = null;
|
||||||
var start_y = null;
|
var start_y = null;
|
||||||
var init_bbox = {};
|
var init_bbox = {};
|
||||||
|
var freehand = {
|
||||||
|
minx: null,
|
||||||
|
miny: null,
|
||||||
|
maxx: null,
|
||||||
|
maxy: null
|
||||||
|
};
|
||||||
|
|
||||||
// - when we are in a create mode, the element is added to the canvas
|
// - when we are in a create mode, the element is added to the canvas
|
||||||
// but the action is not recorded until mousing up
|
// but the action is not recorded until mousing up
|
||||||
|
@ -2611,7 +2614,7 @@ function BatchCommand(text) {
|
||||||
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm );
|
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm );
|
||||||
var mouse_x = pt.x;
|
var mouse_x = pt.x;
|
||||||
var mouse_y = pt.y;
|
var mouse_y = pt.y;
|
||||||
var shape = svgdoc.getElementById(getId());
|
var shape = getElem(getId());
|
||||||
|
|
||||||
x = mouse_x / current_zoom;
|
x = mouse_x / current_zoom;
|
||||||
y = mouse_y / current_zoom;
|
y = mouse_y / current_zoom;
|
||||||
|
@ -2901,7 +2904,7 @@ function BatchCommand(text) {
|
||||||
var y = mouse_y / current_zoom;
|
var y = mouse_y / current_zoom;
|
||||||
|
|
||||||
started = false;
|
started = false;
|
||||||
var element = svgdoc.getElementById(getId());
|
var element = getElem(getId());
|
||||||
var keep = false;
|
var keep = false;
|
||||||
switch (current_mode)
|
switch (current_mode)
|
||||||
{
|
{
|
||||||
|
@ -3217,7 +3220,7 @@ function BatchCommand(text) {
|
||||||
// loop through and hide all pointgrips
|
// loop through and hide all pointgrips
|
||||||
$('#pathpointgrip_container > *').attr("display", "none");
|
$('#pathpointgrip_container > *').attr("display", "none");
|
||||||
|
|
||||||
var line = document.getElementById("path_stretch_line");
|
var line = getElem("path_stretch_line");
|
||||||
if (line) line.setAttribute("display", "none");
|
if (line) line.setAttribute("display", "none");
|
||||||
|
|
||||||
$('#ctrlpointgrip_container *').attr('display','none');
|
$('#ctrlpointgrip_container *').attr('display','none');
|
||||||
|
@ -3250,7 +3253,7 @@ function BatchCommand(text) {
|
||||||
// loop through and show all pointgrips
|
// loop through and show all pointgrips
|
||||||
var len = current_path_pts.length;
|
var len = current_path_pts.length;
|
||||||
for (var i = 0; i < len; i += 2) {
|
for (var i = 0; i < len; i += 2) {
|
||||||
var grip = document.getElementById("pathpointgrip_"+i/2);
|
var grip = getElem("pathpointgrip_"+i/2);
|
||||||
if (grip) {
|
if (grip) {
|
||||||
assignAttributes(grip, {
|
assignAttributes(grip, {
|
||||||
'cx': current_path_pts[i],
|
'cx': current_path_pts[i],
|
||||||
|
@ -3292,14 +3295,14 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
var addPointGripToPath = function(x,y,index) {
|
var addPointGripToPath = function(x,y,index) {
|
||||||
// create the container of all the point grips
|
// create the container of all the point grips
|
||||||
var pointGripContainer = document.getElementById("pathpointgrip_container");
|
var pointGripContainer = getElem("pathpointgrip_container");
|
||||||
if (!pointGripContainer) {
|
if (!pointGripContainer) {
|
||||||
var parent = document.getElementById("selectorParentGroup");
|
var parent = getElem("selectorParentGroup");
|
||||||
pointGripContainer = parent.appendChild(document.createElementNS(svgns, "g"));
|
pointGripContainer = parent.appendChild(document.createElementNS(svgns, "g"));
|
||||||
pointGripContainer.id = "pathpointgrip_container";
|
pointGripContainer.id = "pathpointgrip_container";
|
||||||
}
|
}
|
||||||
|
|
||||||
var pointGrip = document.getElementById("pathpointgrip_"+index);
|
var pointGrip = getElem("pathpointgrip_"+index);
|
||||||
// create it
|
// create it
|
||||||
if (!pointGrip) {
|
if (!pointGrip) {
|
||||||
pointGrip = document.createElementNS(svgns, "circle");
|
pointGrip = document.createElementNS(svgns, "circle");
|
||||||
|
@ -3326,7 +3329,7 @@ function BatchCommand(text) {
|
||||||
assignAttributes(pointGrip, {
|
assignAttributes(pointGrip, {
|
||||||
'cx': x,
|
'cx': x,
|
||||||
'cy': y,
|
'cy': y,
|
||||||
'display': "inline",
|
'display': "inline"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3337,7 +3340,7 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
var updateSegLine = function(next_node) {
|
var updateSegLine = function(next_node) {
|
||||||
// create segment line
|
// create segment line
|
||||||
var segLine = document.getElementById("segline");
|
var segLine = getElem("segline");
|
||||||
if(!segLine) {
|
if(!segLine) {
|
||||||
var pointGripContainer = $('#pathpointgrip_container')[0];
|
var pointGripContainer = $('#pathpointgrip_container')[0];
|
||||||
segLine = document.createElementNS(svgns, "path");
|
segLine = document.createElementNS(svgns, "path");
|
||||||
|
@ -3481,12 +3484,12 @@ function BatchCommand(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the point grip
|
// move the point grip
|
||||||
var grip = document.getElementById("pathpointgrip_" + current_path_pt_drag);
|
var grip = getElem("pathpointgrip_" + current_path_pt_drag);
|
||||||
if (grip) {
|
if (grip) {
|
||||||
grip.setAttribute("cx", mouse_x);
|
grip.setAttribute("cx", mouse_x);
|
||||||
grip.setAttribute("cy", mouse_y);
|
grip.setAttribute("cy", mouse_y);
|
||||||
if(is_closed && is_first) {
|
if(is_closed && is_first) {
|
||||||
var grip = document.getElementById("pathpointgrip_" + last_index);
|
var grip = getElem("pathpointgrip_" + last_index);
|
||||||
grip.setAttribute("cx", mouse_x);
|
grip.setAttribute("cx", mouse_x);
|
||||||
grip.setAttribute("cy", mouse_y);
|
grip.setAttribute("cy", mouse_y);
|
||||||
}
|
}
|
||||||
|
@ -3498,7 +3501,7 @@ function BatchCommand(text) {
|
||||||
if(cur_type != 4) {
|
if(cur_type != 4) {
|
||||||
var num = is_first?last_index:index;
|
var num = is_first?last_index:index;
|
||||||
var id2 = (num-1)+'c2';
|
var id2 = (num-1)+'c2';
|
||||||
var line = document.getElementById("ctrlLine_"+id2);
|
var line = getElem("ctrlLine_"+id2);
|
||||||
if(line) {
|
if(line) {
|
||||||
// Don't do if first point on open path
|
// Don't do if first point on open path
|
||||||
if(!(!is_closed && current_path_pt_drag == 0)) {
|
if(!(!is_closed && current_path_pt_drag == 0)) {
|
||||||
|
@ -3511,7 +3514,7 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
if(next_type != 4) {
|
if(next_type != 4) {
|
||||||
var id1 = (current_path_pt_drag)+'c1';
|
var id1 = (current_path_pt_drag)+'c1';
|
||||||
var line = document.getElementById("ctrlLine_"+id1);
|
var line = getElem("ctrlLine_"+id1);
|
||||||
if(line) {
|
if(line) {
|
||||||
var x2 = line.getAttribute('x2') - 0 + x_diff*current_zoom;
|
var x2 = line.getAttribute('x2') - 0 + x_diff*current_zoom;
|
||||||
var y2 = line.getAttribute('y2') - 0 + y_diff*current_zoom;
|
var y2 = line.getAttribute('y2') - 0 + y_diff*current_zoom;
|
||||||
|
@ -3562,12 +3565,12 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
updateSegLine(true);
|
updateSegLine(true);
|
||||||
|
|
||||||
var grip = document.getElementById("ctrlpointgrip_" + ctrl_pt_drag);
|
var grip = getElem("ctrlpointgrip_" + ctrl_pt_drag);
|
||||||
if(grip) {
|
if(grip) {
|
||||||
grip.setAttribute("cx", mouse_x);
|
grip.setAttribute("cx", mouse_x);
|
||||||
grip.setAttribute("cy", mouse_y);
|
grip.setAttribute("cy", mouse_y);
|
||||||
|
|
||||||
var line = document.getElementById("ctrlLine_"+ctrl_pt_drag);
|
var line = getElem("ctrlLine_"+ctrl_pt_drag);
|
||||||
line.setAttribute("x2", mouse_x);
|
line.setAttribute("x2", mouse_x);
|
||||||
line.setAttribute("y2", mouse_y);
|
line.setAttribute("y2", mouse_y);
|
||||||
}
|
}
|
||||||
|
@ -3600,15 +3603,15 @@ function BatchCommand(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the container of all the control point grips
|
// create the container of all the control point grips
|
||||||
var ctrlPointGripContainer = document.getElementById("ctrlpointgrip_container");
|
var ctrlPointGripContainer = getElem("ctrlpointgrip_container");
|
||||||
if (!ctrlPointGripContainer) {
|
if (!ctrlPointGripContainer) {
|
||||||
var parent = document.getElementById("selectorParentGroup");
|
var parent = getElem("selectorParentGroup");
|
||||||
ctrlPointGripContainer = parent.appendChild(document.createElementNS(svgns, "g"));
|
ctrlPointGripContainer = parent.appendChild(document.createElementNS(svgns, "g"));
|
||||||
ctrlPointGripContainer.id = "ctrlpointgrip_container";
|
ctrlPointGripContainer.id = "ctrlpointgrip_container";
|
||||||
}
|
}
|
||||||
ctrlPointGripContainer.setAttribute("display", "inline");
|
ctrlPointGripContainer.setAttribute("display", "inline");
|
||||||
|
|
||||||
var ctrlLine = document.getElementById("ctrlLine_"+id);
|
var ctrlLine = getElem("ctrlLine_"+id);
|
||||||
if (!ctrlLine) {
|
if (!ctrlLine) {
|
||||||
ctrlLine = document.createElementNS(svgns, "line");
|
ctrlLine = document.createElementNS(svgns, "line");
|
||||||
assignAttributes(ctrlLine, {
|
assignAttributes(ctrlLine, {
|
||||||
|
@ -3628,7 +3631,7 @@ function BatchCommand(text) {
|
||||||
'display': "inline"
|
'display': "inline"
|
||||||
});
|
});
|
||||||
|
|
||||||
var pointGrip = document.getElementById("ctrlpointgrip_"+id);
|
var pointGrip = getElem("ctrlpointgrip_"+id);
|
||||||
// create it
|
// create it
|
||||||
if (!pointGrip) {
|
if (!pointGrip) {
|
||||||
pointGrip = document.createElementNS(svgns, "circle");
|
pointGrip = document.createElementNS(svgns, "circle");
|
||||||
|
@ -3736,7 +3739,7 @@ function BatchCommand(text) {
|
||||||
R_nc.setRotate((angle * 180.0 / Math.PI), newcx, newcy);
|
R_nc.setRotate((angle * 180.0 / Math.PI), newcx, newcy);
|
||||||
tlist.replaceItem(R_nc,0);
|
tlist.replaceItem(R_nc,0);
|
||||||
|
|
||||||
if(document.getElementById("pathpointgrip_container")) {
|
if(getElem("pathpointgrip_container")) {
|
||||||
var pcx = newcx * current_zoom,
|
var pcx = newcx * current_zoom,
|
||||||
pcy = newcy * current_zoom;
|
pcy = newcy * current_zoom;
|
||||||
var xform = ["rotate(", (angle*180.0/Math.PI), " ", pcx, ",", pcy, ")"].join("");
|
var xform = ["rotate(", (angle*180.0/Math.PI), " ", pcx, ",", pcy, ")"].join("");
|
||||||
|
@ -3805,7 +3808,7 @@ function BatchCommand(text) {
|
||||||
},
|
},
|
||||||
mouseMove: function(mouse_x, mouse_y) {
|
mouseMove: function(mouse_x, mouse_y) {
|
||||||
if(current_mode == "path") {
|
if(current_mode == "path") {
|
||||||
var line = document.getElementById("path_stretch_line");
|
var line = getElem("path_stretch_line");
|
||||||
if (line) {
|
if (line) {
|
||||||
line.setAttribute("x2", x *= current_zoom);
|
line.setAttribute("x2", x *= current_zoom);
|
||||||
line.setAttribute("y2", y *= current_zoom);
|
line.setAttribute("y2", y *= current_zoom);
|
||||||
|
@ -3862,7 +3865,7 @@ function BatchCommand(text) {
|
||||||
var x = mouse_x/current_zoom;
|
var x = mouse_x/current_zoom;
|
||||||
var y = mouse_y/current_zoom;
|
var y = mouse_y/current_zoom;
|
||||||
|
|
||||||
var stretchy = document.getElementById("path_stretch_line");
|
var stretchy = getElem("path_stretch_line");
|
||||||
if (!stretchy) {
|
if (!stretchy) {
|
||||||
stretchy = document.createElementNS(svgns, "line");
|
stretchy = document.createElementNS(svgns, "line");
|
||||||
assignAttributes(stretchy, {
|
assignAttributes(stretchy, {
|
||||||
|
@ -3870,7 +3873,7 @@ function BatchCommand(text) {
|
||||||
'stroke': "blue",
|
'stroke': "blue",
|
||||||
'stroke-width': "0.5"
|
'stroke-width': "0.5"
|
||||||
});
|
});
|
||||||
stretchy = document.getElementById("selectorParentGroup").appendChild(stretchy);
|
stretchy = getElem("selectorParentGroup").appendChild(stretchy);
|
||||||
}
|
}
|
||||||
stretchy.setAttribute("display", "inline");
|
stretchy.setAttribute("display", "inline");
|
||||||
|
|
||||||
|
@ -3921,7 +3924,7 @@ function BatchCommand(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get path element that we are in the process of creating
|
// get path element that we are in the process of creating
|
||||||
var path = svgdoc.getElementById(getId());
|
var path = getElem(getId());
|
||||||
var len = current_path_pts.length;
|
var len = current_path_pts.length;
|
||||||
// if we clicked on an existing point, then we are done this path, commit it
|
// if we clicked on an existing point, then we are done this path, commit it
|
||||||
// (i,i+1) are the x,y that were clicked on
|
// (i,i+1) are the x,y that were clicked on
|
||||||
|
@ -4065,7 +4068,7 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
clear: function(remove) {
|
clear: function(remove) {
|
||||||
if(remove && current_mode == "path") {
|
if(remove && current_mode == "path") {
|
||||||
var elem = svgdoc.getElementById(getId());
|
var elem = getElem(getId());
|
||||||
if(elem) elem.parentNode.removeChild(elem);
|
if(elem) elem.parentNode.removeChild(elem);
|
||||||
}
|
}
|
||||||
removeAllPointGripsFromPath();
|
removeAllPointGripsFromPath();
|
||||||
|
@ -4106,7 +4109,7 @@ function BatchCommand(text) {
|
||||||
modeChange: function() {
|
modeChange: function() {
|
||||||
// toss out half-drawn path
|
// toss out half-drawn path
|
||||||
if (current_mode == "path" && current_path_pts.length > 0) {
|
if (current_mode == "path" && current_path_pts.length > 0) {
|
||||||
var elem = svgdoc.getElementById(getId());
|
var elem = getElem(getId());
|
||||||
elem.parentNode.removeChild(elem);
|
elem.parentNode.removeChild(elem);
|
||||||
this.clear();
|
this.clear();
|
||||||
canvas.clearSelection();
|
canvas.clearSelection();
|
||||||
|
@ -5664,7 +5667,7 @@ function BatchCommand(text) {
|
||||||
elem.setAttribute("transform", oldTransform);
|
elem.setAttribute("transform", oldTransform);
|
||||||
this.changeSelectedAttribute("transform",newTransform,selectedElements);
|
this.changeSelectedAttribute("transform",newTransform,selectedElements);
|
||||||
}
|
}
|
||||||
var pointGripContainer = document.getElementById("pathpointgrip_container");
|
var pointGripContainer = getElem("pathpointgrip_container");
|
||||||
if(elem.nodeName == "path" && pointGripContainer) {
|
if(elem.nodeName == "path" && pointGripContainer) {
|
||||||
pathActions.setPointContainerTransform(elem.getAttribute("transform"));
|
pathActions.setPointContainerTransform(elem.getAttribute("transform"));
|
||||||
}
|
}
|
||||||
|
@ -6593,8 +6596,30 @@ function BatchCommand(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
};
|
|
||||||
|
|
||||||
|
var done = false;
|
||||||
|
|
||||||
|
function getElem(id) {
|
||||||
|
|
||||||
|
if(svgroot.querySelector) {
|
||||||
|
// querySelector lookup
|
||||||
|
return svgroot.querySelector('#'+id);
|
||||||
|
} else if(svgdoc.evaluate) {
|
||||||
|
if(!done) {
|
||||||
|
alert('e')
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
// xpath lookup
|
||||||
|
return svgdoc.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+id+'"]', container, function() { return "http://www.w3.org/2000/svg"; }, 9, null).singleNodeValue;
|
||||||
|
} else {
|
||||||
|
// jQuery lookup: twice as slow as xpath in FF
|
||||||
|
return $(svgroot).find('[id=' + id + ']')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// getElementById lookup: includes icons, not good
|
||||||
|
// return svgdoc.getElementById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Static class for various utility functions
|
// Static class for various utility functions
|
||||||
|
|
||||||
var Utils = {
|
var Utils = {
|
||||||
|
|
Loading…
Reference in New Issue