summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-09-15 19:00:40 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-09-15 19:00:40 +0000
commit803e249e999ab90caf2e3d61cc6782aa7dd3caba (patch)
treeba1532a2eaea036d15f9566e65de38b1a3746397 /src
parentFix bug with tool handles during document unit change. (diff)
downloadinkscape-803e249e999ab90caf2e3d61cc6782aa7dd3caba.tar.gz
inkscape-803e249e999ab90caf2e3d61cc6782aa7dd3caba.zip
Fix document unit change for transformed flow text and transformed text on path.
(bzr r12475.1.18)
Diffstat (limited to 'src')
-rw-r--r--src/sp-flowtext.cpp8
-rw-r--r--src/sp-flowtext.h6
-rw-r--r--src/sp-item-group.cpp25
3 files changed, 30 insertions, 9 deletions
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 304d749c2..4fc922a82 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -86,6 +86,8 @@ sp_flowtext_init(SPFlowtext *group)
{
group->par_indent = 0;
new (&group->layout) Inkscape::Text::Layout();
+
+ group->_optimizeScaledText = false;
}
static void
@@ -706,9 +708,13 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
static Geom::Affine
sp_flowtext_set_transform (SPItem *item, Geom::Affine const &xform)
{
- if (!xform.isNonzeroUniformScale()) {
+ SPFlowtext *ft = SP_FLOWTEXT(item);
+ if ((ft->_optimizeScaledText && !xform.withoutTranslation().isNonzeroUniformScale())
+ || (!ft->_optimizeScaledText && !xform.isNonzeroUniformScale())) {
+ ft->_optimizeScaledText = false;
return xform;
}
+ ft->_optimizeScaledText = false;
SPText *text = reinterpret_cast<SPText *>(item);
diff --git a/src/sp-flowtext.h b/src/sp-flowtext.h
index 944503a1e..6857f5760 100644
--- a/src/sp-flowtext.h
+++ b/src/sp-flowtext.h
@@ -43,6 +43,12 @@ struct SPFlowtext : public SPItem {
double par_indent;
+ bool _optimizeScaledText;
+
+ /** Optimize scaled flow text on next set_transform. */
+ void optimizeScaledText()
+ {_optimizeScaledText = true;}
+
private:
/** Recursively walks the xml tree adding tags and their contents. */
void _buildLayoutInput(SPObject *root, Shape const *exclusion_shape, std::list<Shape> *shapes, SPObject **pending_line_break_object);
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index be62764c3..1b8af43e1 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -51,8 +51,8 @@
#include "sp-defs.h"
#include "verbs.h"
#include "layer-model.h"
-#include "selection-chemistry.h"
#include "sp-textpath.h"
+#include "sp-flowtext.h"
using Inkscape::DocumentUndo;
@@ -585,18 +585,27 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p)
old_center = item->getCenter();
}
- if (SP_IS_TEXT_TEXTPATH(item) && item->transform.isIdentity()) {
- if (item->transform.isIdentity()) {
- SP_TEXT(item)->optimizeTextpathText();
- } else {
- // TODO: transformed text on textpath
- }
+ if (SP_IS_TEXT_TEXTPATH(item)) {
+ SP_TEXT(item)->optimizeTextpathText();
+ } else if (SP_IS_FLOWTEXT(item)) {
+ SP_FLOWTEXT(item)->optimizeScaledText();
} else if (SP_IS_BOX3D(item)) {
// Force recalculation from perspective
box3d_position_set(SP_BOX3D(item));
}
- if (SP_IS_USE(item)) {
+ if ((SP_IS_TEXT_TEXTPATH(item) || SP_IS_FLOWTEXT(item)) && !item->transform.isIdentity()) {
+ // Save and reset current transform
+ Geom::Affine tmp(item->transform);
+ item->transform = Geom::Affine();
+ // Apply scale
+ item->set_i2d_affine(item->i2dt_affine() * sc);
+ item->doWriteTransform(item->getRepr(), item->transform, NULL, true);
+ // Scale translation and restore original transform
+ tmp[4] *= sc[0];
+ tmp[5] *= sc[1];
+ item->doWriteTransform(item->getRepr(), tmp, NULL, true);
+ } else if (SP_IS_USE(item)) {
// calculate the matrix we need to apply to the clone
// to cancel its induced transform from its original
Geom::Affine move = final.inverse() * item->transform * final;