summaryrefslogtreecommitdiffstats
path: root/src/sp-offset.cpp
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2011-03-17 19:13:06 +0000
committerJazzyNico <nicoduf@yahoo.fr>2011-03-17 19:13:06 +0000
commitab5c39d6151762215e0fa7e1bbd159e40bc751ab (patch)
tree475732b690aacb18d341e4254a9cbf26d059d9d5 /src/sp-offset.cpp
parentFilters. Custom predefined filters fine tuning (precision and UI labels). (diff)
downloadinkscape-ab5c39d6151762215e0fa7e1bbd159e40bc751ab.tar.gz
inkscape-ab5c39d6151762215e0fa7e1bbd159e40bc751ab.zip
Linked Offset. Merge branch lp:~ado-papas/inkscape/bug_167419 (Bug #167419, Bug #184341, Bug #239430).
(bzr r10109)
Diffstat (limited to 'src/sp-offset.cpp')
-rw-r--r--src/sp-offset.cpp45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 5cad7540d..57c04f31f 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -1029,30 +1029,37 @@ sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint mode = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_PARALLEL);
- if (mode == SP_CLONE_COMPENSATION_NONE) return;
+
+ SPItem *item = SP_ITEM(self);
Geom::Affine m(*mp);
- if (!(m.isTranslation())) return;
+ if (!(m.isTranslation()) || mode == SP_CLONE_COMPENSATION_NONE) {
+ self->sourceDirty=true;
+ item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ return;
+ }
// calculate the compensation matrix and the advertized movement matrix
- SPItem *item = SP_ITEM(self);
+ item->readAttr("transform");
- Geom::Affine compensate;
- Geom::Affine advertized_move;
+ Geom::Affine t = self->transform;
+ Geom::Affine offset_move = t.inverse() * m * t;
- if (mode == SP_CLONE_COMPENSATION_UNMOVED) {
- compensate = Geom::identity();
- advertized_move.setIdentity();
- } else if (mode == SP_CLONE_COMPENSATION_PARALLEL) {
- compensate = m;
+ Geom::Affine advertized_move;
+ if (mode == SP_CLONE_COMPENSATION_PARALLEL) {
+ offset_move = offset_move.inverse() * m;
advertized_move = m;
+ } else if (mode == SP_CLONE_COMPENSATION_UNMOVED) {
+ offset_move = offset_move.inverse();
+ advertized_move.setIdentity();
} else {
g_assert_not_reached();
}
- item->transform *= compensate;
+ self->sourceDirty=true;
// commit the compensation
+ item->transform *= offset_move;
item->doWriteTransform(item->getRepr(), item->transform, &advertized_move);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
@@ -1075,12 +1082,13 @@ sp_offset_delete_self(SPObject */*deleted*/, SPOffset *offset)
}
static void
-sp_offset_source_modified (SPObject */*iSource*/, guint /*flags*/, SPItem *item)
+sp_offset_source_modified (SPObject */*iSource*/, guint flags, SPItem *item)
{
SPOffset *offset = SP_OFFSET(item);
offset->sourceDirty=true;
- refresh_offset_source(offset);
- ((SPShape *) offset)->setShape ();
+ if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG)) {
+ offset->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ }
}
static void
@@ -1111,6 +1119,15 @@ refresh_offset_source(SPOffset* offset)
orig->LoadPathVector(curve->get_pathvector());
curve->unref();
+ if (!item->transform.isIdentity()) {
+ gchar const *t_attr = item->getRepr()->attribute("transform");
+ if (t_attr) {
+ Geom::Affine t;
+ if (sp_svg_transform_read(t_attr, &t)) {
+ orig->Transform(t);
+ }
+ }
+ }
// Finish up.
{