Fixed bug on rotation created in r408

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@412 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2009-08-18 19:05:42 +00:00
parent 97d9c8b76a
commit 546c96ed14

View File

@@ -734,13 +734,17 @@ function SvgCanvas(c)
cy = remapy(box.y + box.height/2); cy = remapy(box.y + box.height/2);
var rotate = ["rotate(", angle, " ", cx, ",", cy, ")"].join(''); var rotate = ["rotate(", angle, " ", cx, ",", cy, ")"].join('');
selected.setAttribute("transform", rotate); selected.setAttribute("transform", rotate);
pointGripContainer.setAttribute("transform", rotate); if(pointGripContainer) {
pointGripContainer.setAttribute("transform", rotate);
}
} }
else { else {
selected.setAttribute("transform", ""); selected.setAttribute("transform", "");
selected.removeAttribute("transform"); selected.removeAttribute("transform");
pointGripContainer.setAttribute("transform", ""); if(pointGripContainer) {
pointGripContainer.removeAttribute("transform"); pointGripContainer.setAttribute("transform", "");
pointGripContainer.removeAttribute("transform");
}
} }
switch (selected.tagName) switch (selected.tagName)
@@ -2131,14 +2135,14 @@ function SvgCanvas(c)
this.setRotationAngle = function(val) { this.setRotationAngle = function(val) {
var elem = selectedElements[0]; var elem = selectedElements[0];
var bbox = this.getBBox(elem); var bbox = this.getBBox(elem);
var rotate = "rotate(" + val + " " +
this.changeSelectedAttribute("transform", "rotate(" + val + " " +
(bbox.x+bbox.width/2) + "," + (bbox.x+bbox.width/2) + "," +
(bbox.y+bbox.height/2) + ")"); (bbox.y+bbox.height/2) + ")";
this.changeSelectedAttribute("transform", rotate);
var pointGripContainer = document.getElementById("polypointgrip_container"); var pointGripContainer = document.getElementById("polypointgrip_container");
pointGripContainer.setAttribute("transform", "rotate(" + val + " " + if(pointGripContainer) {
(bbox.x+bbox.width/2) + "," + pointGripContainer.setAttribute("transform", rotate);
(bbox.y+bbox.height/2) + ")"); }
}; };