Fix issue 1053: tspans now get remapped when their text parent are translated
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2460 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -93,19 +93,6 @@ svgedit.coords.remapElement = function(selected, changes, m) {
|
||||
t_new = svgedit.math.matrixMultiply(existing.inverse(), m, existing);
|
||||
changes.x = parseFloat(changes.x) + t_new.e;
|
||||
changes.y = parseFloat(changes.y) + t_new.f;
|
||||
// TODO(codedread): Special handing for tspans:
|
||||
// <g transform="translate(-100,0)">
|
||||
// <text x="100" y="100">
|
||||
// <tspan x="200" y="100">...</tspan>
|
||||
// </text>
|
||||
// </g>
|
||||
//
|
||||
// Note that if the <text> element's x/y coordinates are being
|
||||
// adjusted, the tspan's x/y coordinates also need to be similarly
|
||||
// transformed as the coordinate space is not nested:
|
||||
// <text x="0" y="100">
|
||||
// <tspan x="100" y="100">...</tspan>
|
||||
// </text>
|
||||
} else {
|
||||
// we just absorb all matrices into the element and don't do any remapping
|
||||
var chlist = svgedit.transformlist.getTransformList(selected);
|
||||
@@ -171,6 +158,7 @@ svgedit.coords.remapElement = function(selected, changes, m) {
|
||||
changes.y2 = pt2.y;
|
||||
// deliberately fall through here
|
||||
case 'text':
|
||||
case 'tspan':
|
||||
case 'use':
|
||||
finishUp();
|
||||
break;
|
||||
|
||||
@@ -754,6 +754,23 @@ svgedit.recalculate.recalculateDimensions = function(selected) {
|
||||
tlist.appendItem(newRot);
|
||||
}
|
||||
}
|
||||
// We have special processing for tspans: Tspans are not transformable
|
||||
// but they can have x,y coordinates (sigh). Thus, if this was a translate,
|
||||
// on a text element, also translate any tspan children.
|
||||
if (selected.tagName == 'text') {
|
||||
var children = selected.childNodes;
|
||||
var c = children.length;
|
||||
while (c--) {
|
||||
var child = children.item(c);
|
||||
if (child.tagName == 'tspan') {
|
||||
var tspanChanges = {
|
||||
x: $(child).attr('x') || 0,
|
||||
y: $(child).attr('y') || 0
|
||||
};
|
||||
svgedit.coords.remapElement(child, tspanChanges, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// [Rold][M][T][S][-T] became [Rold][M]
|
||||
// we want it to be [Rnew][M][Tr] where Tr is the
|
||||
|
||||
Reference in New Issue
Block a user