Resizing rotated elements behaves better (though the bbox selector still has the wrong dimensions at the end of a drag, I may live with it for this release)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@393 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-08-17 03:11:30 +00:00
parent eb97d20600
commit a20d175681
1 changed files with 3 additions and 11 deletions

View File

@ -1168,7 +1168,7 @@ function SvgCanvas(c)
} }
}; };
// in mouseMove we do not record any state changes yet (but we do update // in this function we do not record any state changes yet (but we do update
// any elements that are still being created, moved or resized on the canvas) // any elements that are still being created, moved or resized on the canvas)
// TODO: svgcanvas should just retain a reference to the image being dragged instead // TODO: svgcanvas should just retain a reference to the image being dragged instead
// of the getId() and getElementById() funkiness - this will help us customize the ids // of the getId() and getElementById() funkiness - this will help us customize the ids
@ -1297,7 +1297,7 @@ function SvgCanvas(c)
if (angle) { if (angle) {
var cx = selectedBBox.x + selectedBBox.width/2, var cx = selectedBBox.x + selectedBBox.width/2,
cy = selectedBBox.y + selectedBBox.height/2; cy = selectedBBox.y + selectedBBox.height/2;
ts += [" rotate(", angle, " ", cx, ",", cy, ")"].join('') ts = ["rotate(", angle, " ", cx, ",", cy, ")", ts].join('')
} }
selected.setAttribute("transform", ts); selected.setAttribute("transform", ts);
selectorManager.requestSelector(selected).resize(selectedBBox); selectorManager.requestSelector(selected).resize(selectedBBox);
@ -2083,8 +2083,6 @@ function SvgCanvas(c)
var pts = [ [-w2,-h2], [w2,-h2], var pts = [ [-w2,-h2], [w2,-h2],
[w2,h2], [-w2,h2] ]; [w2,h2], [-w2,h2] ];
var r = Math.sqrt( w2*w2 + h2*h2 ); var r = Math.sqrt( w2*w2 + h2*h2 );
console.log(pts);
console.log(r);
var i = 4; var i = 4;
var MINX = Number.MAX_VALUE, MINY = Number.MAX_VALUE, var MINX = Number.MAX_VALUE, MINY = Number.MAX_VALUE,
MAXX = Number.MIN_VALUE, MAXY = Number.MIN_VALUE; MAXX = Number.MIN_VALUE, MAXY = Number.MIN_VALUE;
@ -2129,12 +2127,6 @@ function SvgCanvas(c)
this.changeSelectedAttribute("transform", "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) + ")");
// TODO: map from this element's CTM to the viewport
// see http://www.w3.org/Graphics/SVG/WG/track/issues/2283 for one way to do this
// bbox = selectedBBoxes[0] =
// console.log(bbox.x + "," + bbox.y + " " + bbox.width + "," + bbox.height);
// setTimeout(function() {selectorManager.requestSelector(elem).resize(selectedBBoxes[i]);},0);
}; };
this.each = function(cb) { this.each = function(cb) {