Code

now this is the correct way to avoid nested updates, instead of the hack i recently...
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 29 Jul 2007 05:27:33 +0000 (05:27 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 29 Jul 2007 05:27:33 +0000 (05:27 +0000)
src/sp-text.cpp

index d1105ac2065987e817fa3a709e2c3e17558ac516..cc575d99f7dc473e042a4364334066737590eb22 100644 (file)
@@ -587,8 +587,7 @@ void SPText::rebuildLayout()
         if (!tspan->attributes.singleXYCoordinates()) continue;
         Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan);
         NR::Point anchor_point = layout.chunkAnchorPoint(iter);
-        sp_repr_set_svg_double(SP_OBJECT_REPR(tspan), "x", anchor_point[NR::X]);
-        sp_repr_set_svg_double(SP_OBJECT_REPR(tspan), "y", anchor_point[NR::Y]);
+        tspan->attributes.setFirstXY(anchor_point);
     }
 }
 
@@ -725,6 +724,19 @@ NR::Point TextTagAttributes::firstXY() const
     return point;
 }
 
+void TextTagAttributes::setFirstXY(NR::Point &point)
+{
+    SVGLength zero_length;
+    zero_length = 0.0;
+
+    if (attributes.x.empty())
+        attributes.x.resize(1, zero_length);
+    if (attributes.y.empty())
+        attributes.y.resize(1, zero_length);
+    attributes.x[0].computed = point[NR::X];
+    attributes.y[0].computed = point[NR::Y];
+}
+
 void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *output, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_attrs, unsigned parent_attrs_offset, bool copy_xy, bool copy_dxdyrotate) const
 {
     mergeSingleAttribute(&output->x,      parent_attrs.x,      parent_attrs_offset, copy_xy ? &attributes.x : NULL);