Fixed issue 472 in a somewhat hacky way

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1572 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-05-18 14:54:35 +00:00
parent 19a8549a64
commit 63bde23fed
2 changed files with 22 additions and 14 deletions

View File

@ -1823,15 +1823,6 @@
*/
// var setIcon = function(holder_sel, id) {
// var icon = $.getSvgIcon(id).clone();
// var holder = $(holder_sel);
// icon[0].setAttribute('width',holder.width());
// icon[0].setAttribute('height',holder.height());
// holder.empty().append(icon)
// .attr('data-curopt', holder_sel.replace('_show','')); // This sets the current mode
// }
// Unfocus text input when workarea is mousedowned.
(function() {
var inp;
@ -2296,7 +2287,7 @@
var icon = $.getSvgIcon(icon_id).clone();
$(elem).empty().append(icon);
var size = curPrefs.iconsize;
if(size !== 'm') {
if(size && size !== 'm') {
var icon_sizes = { s:16, m:24, l:32, xl:48}, obj = {};
obj[elem + ' .svg_icon'] = icon_sizes[size];
$.resizeSvgIcons(obj);

View File

@ -961,7 +961,6 @@ function BatchCommand(text) {
'</svg>').documentElement, true);
$(svgroot).appendTo(container);
var opac_ani = document.createElementNS(svgns, 'animate');
$(opac_ani).attr({
attributeName: 'opacity',
@ -1777,7 +1776,9 @@ function BatchCommand(text) {
var i = selectedElements.length;
while(i--) {
var cmd = recalculateDimensions(selectedElements[i]);
var elem = selectedElements[i];
// if(canvas.getRotationAngle(elem) && !hasMatrixTransform(canvas.getTransformList(elem))) continue;
var cmd = recalculateDimensions(elem);
if (cmd) {
batchCmd.addSubCommand(cmd);
}
@ -2052,6 +2053,8 @@ function BatchCommand(text) {
}
}
}
// End here if all it has is a rotation
if(tlist.numberOfItems == 1 && canvas.getRotationAngle(selected)) return null;
}
// if this element had no transforms, we are done
@ -2132,6 +2135,7 @@ function BatchCommand(text) {
transformListToTransform(tlist).matrix),
m = svgroot.createSVGMatrix();
// temporarily strip off the rotate and save the old center
var gangle = canvas.getRotationAngle(selected);
if (gangle) {
@ -2157,7 +2161,11 @@ function BatchCommand(text) {
var tx = 0, ty = 0,
operation = 0,
N = tlist.numberOfItems;
if(N) {
var first_m = tlist.getItem(0).matrix;
}
// first, if it was a scale then the second-last transform will be it
if (N >= 3 && tlist.getItem(N-2).type == 3 &&
tlist.getItem(N-3).type == 2 && tlist.getItem(N-1).type == 2)
@ -2359,6 +2367,11 @@ function BatchCommand(text) {
// if it was a translate, put back the rotate at the new center
if (operation == 2) {
if (gangle) {
newcenter = {
x: oldcenter.x + first_m.e,
y: oldcenter.y + first_m.f
};
var newRot = svgroot.createSVGTransform();
newRot.setRotate(gangle,newcenter.x,newcenter.y);
tlist.insertItemBefore(newRot, 0);
@ -2550,8 +2563,12 @@ function BatchCommand(text) {
// if it was a translate, put back the rotate at the new center
if (operation == 2) {
if (angle) {
newcenter = {
x: oldcenter.x + m.e,
y: oldcenter.y + m.f
};
var newRot = svgroot.createSVGTransform();
newRot.setRotate(angle,newcenter.x,newcenter.y);
newRot.setRotate(angle, newcenter.x, newcenter.y);
tlist.insertItemBefore(newRot, 0);
}
}