Rename recalculateSelectedDimensions() to recalculatDimensions()
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@603 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
a4f00f9c53
commit
45388a21f3
|
@ -53,7 +53,7 @@ function ChangeElementCommand(elem, attrs, text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// relocate rotational transform, if necessary
|
// relocate rotational transform, if necessary
|
||||||
if (attr != "transform") {
|
if($.inArray("transform", this.newValues) == -1) {
|
||||||
var angle = canvas.getRotationAngle(elem);
|
var angle = canvas.getRotationAngle(elem);
|
||||||
if (angle) {
|
if (angle) {
|
||||||
var bbox = elem.getBBox();
|
var bbox = elem.getBBox();
|
||||||
|
@ -80,7 +80,7 @@ function ChangeElementCommand(elem, attrs, text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// relocate rotational transform, if necessary
|
// relocate rotational transform, if necessary
|
||||||
if (attr != "transform") {
|
if($.inArray("transform", this.oldValues) == -1) {
|
||||||
var angle = canvas.getRotationAngle(elem);
|
var angle = canvas.getRotationAngle(elem);
|
||||||
if (angle) {
|
if (angle) {
|
||||||
var bbox = elem.getBBox();
|
var bbox = elem.getBBox();
|
||||||
|
@ -861,7 +861,7 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
var i = selectedElements.length;
|
var i = selectedElements.length;
|
||||||
while(i--) {
|
while(i--) {
|
||||||
var cmd = recalculateSelectedDimensions(i);
|
var cmd = recalculateDimensions(selectedElements[i],selectedBBoxes[i]);
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
batchCmd.addSubCommand(cmd);
|
batchCmd.addSubCommand(cmd);
|
||||||
}
|
}
|
||||||
|
@ -879,10 +879,8 @@ function BatchCommand(text) {
|
||||||
's', 's', 't', 't' ];
|
's', 's', 't', 't' ];
|
||||||
|
|
||||||
// this function returns the command which resulted from the selected change
|
// this function returns the command which resulted from the selected change
|
||||||
var recalculateSelectedDimensions = function(i) {
|
var recalculateDimensions = function(selected,selectedBBox) {
|
||||||
var selected = selectedElements[i];
|
if (selected == null || selectedBBox == null) return null;
|
||||||
if (selected == null) return null;
|
|
||||||
var selectedBBox = selectedBBoxes[i];
|
|
||||||
var box = canvas.getBBox(selected);
|
var box = canvas.getBBox(selected);
|
||||||
|
|
||||||
// if we have not moved/resized, then immediately leave
|
// if we have not moved/resized, then immediately leave
|
||||||
|
@ -1155,6 +1153,9 @@ function BatchCommand(text) {
|
||||||
'height': scaleh(changes["height"])
|
'height': scaleh(changes["height"])
|
||||||
}, 1000);
|
}, 1000);
|
||||||
break;
|
break;
|
||||||
|
case "g":
|
||||||
|
// do work here :P
|
||||||
|
break;
|
||||||
default: // rect
|
default: // rect
|
||||||
console.log("Unknown shape type: " + selected.tagName);
|
console.log("Unknown shape type: " + selected.tagName);
|
||||||
break;
|
break;
|
||||||
|
@ -1246,7 +1247,7 @@ function BatchCommand(text) {
|
||||||
var x = evt.pageX - container.parentNode.offsetLeft + container.parentNode.scrollLeft;
|
var x = evt.pageX - container.parentNode.offsetLeft + container.parentNode.scrollLeft;
|
||||||
var y = evt.pageY - container.parentNode.offsetTop + container.parentNode.scrollTop;
|
var y = evt.pageY - container.parentNode.offsetTop + container.parentNode.scrollTop;
|
||||||
|
|
||||||
evt.preventDefault()
|
evt.preventDefault();
|
||||||
|
|
||||||
if($.inArray(current_mode, ['select', 'resize']) == -1) {
|
if($.inArray(current_mode, ['select', 'resize']) == -1) {
|
||||||
addGradient();
|
addGradient();
|
||||||
|
@ -1260,11 +1261,12 @@ function BatchCommand(text) {
|
||||||
current_resize_mode = "none";
|
current_resize_mode = "none";
|
||||||
var t = evt.target;
|
var t = evt.target;
|
||||||
// if this element is in a group, go up until we reach the top-level group
|
// if this element is in a group, go up until we reach the top-level group
|
||||||
|
// TODO: once we implement Layers, the top-level groups will be layers so
|
||||||
|
// we will want to stop just before then (parentNode.parentNode)
|
||||||
|
// TODO: once we implement links, we also would have to check for <a> elements
|
||||||
while (t.parentNode.tagName == "g") {
|
while (t.parentNode.tagName == "g") {
|
||||||
t = t.parentNode;
|
t = t.parentNode;
|
||||||
}
|
}
|
||||||
// TODO: once we implement Layers, the top-level groups will be layers so
|
|
||||||
// we will want to stop just before then
|
|
||||||
// WebKit returns <div> when the canvas is clicked, Firefox/Opera return <svg>
|
// WebKit returns <div> when the canvas is clicked, Firefox/Opera return <svg>
|
||||||
var nodeName = t.nodeName.toLowerCase();
|
var nodeName = t.nodeName.toLowerCase();
|
||||||
if (nodeName != "div" && nodeName != "svg") {
|
if (nodeName != "div" && nodeName != "svg") {
|
||||||
|
@ -3058,7 +3060,7 @@ function BatchCommand(text) {
|
||||||
} else {
|
} else {
|
||||||
selectedBBoxes[i].y += dy;
|
selectedBBoxes[i].y += dy;
|
||||||
}
|
}
|
||||||
var cmd = recalculateSelectedDimensions(i);
|
var cmd = recalculateDimensions(selected,selectedBBoxes[i]);
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
batchCmd.addSubCommand(cmd);
|
batchCmd.addSubCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue