diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2017-01-25 11:33:08 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2017-01-25 11:33:08 +0000 |
| commit | d8423112d4080f8bc432e3d7a577c877d2cb0ed2 (patch) | |
| tree | 3fc18b797fdb7e359386e63302e26ad99014089a /src/live_effects | |
| parent | update to trunk (diff) | |
| parent | Retain clone position in clone Original LPE (diff) | |
| download | inkscape-d8423112d4080f8bc432e3d7a577c877d2cb0ed2.tar.gz inkscape-d8423112d4080f8bc432e3d7a577c877d2cb0ed2.zip | |
update to trunk
(bzr r13645.1.169)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-clone-original.cpp | 21 | ||||
| -rw-r--r-- | src/live_effects/lpe-clone-original.h | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp index 31d5bab65..e70575986 100644 --- a/src/live_effects/lpe-clone-original.cpp +++ b/src/live_effects/lpe-clone-original.cpp @@ -34,7 +34,8 @@ LPECloneOriginal::LPECloneOriginal(LivePathEffectObject *lpeobject) : filter(_("Clone filter"), _("Clone filter"), "filter", &wr, this, false), attributes("Attributes linked", "Attributes linked, comma separated atributes", "attributes", &wr, this,""), style_attributes("Style attributes linked", "Style attributes linked, comma separated atributes", "style_attributes", &wr, this,""), - expanded(false) + expanded(false), + origin(Geom::Point(0,0)) { registerParameter(&linked_path); registerParameter(&linked_item); @@ -259,8 +260,26 @@ LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){ style_attr.append(Glib::ustring(style_attributes.param_getSVGValue()).append(",")); if (inverse) { cloneAttrbutes(SP_OBJECT(sp_lpe_item), linked_item.getObject(), true, g_strdup(attr.c_str()), g_strdup(style_attr.c_str()), true); + Geom::OptRect bbox = SP_ITEM(sp_lpe_item)->geometricBounds(); + if (bbox && preserve_position && origin != Geom::Point(0,0)) { + origin = (*bbox).corner(0) - origin; + SP_ITEM(linked_item.getObject())->transform *= Geom::Translate(origin); + } + bbox = SP_ITEM(sp_lpe_item)->geometricBounds(); + if (bbox && preserve_position) { + origin = (*bbox).corner(0); + } } else { cloneAttrbutes(linked_item.getObject(), SP_OBJECT(sp_lpe_item), true, g_strdup(attr.c_str()), g_strdup(style_attr.c_str()), true); + Geom::OptRect bbox = SP_ITEM(linked_item.getObject())->geometricBounds(); + if (bbox && preserve_position && origin != Geom::Point(0,0)) { + origin = (*bbox).corner(0) - origin; + SP_ITEM(sp_lpe_item)->transform *= Geom::Translate(origin); + } + bbox = SP_ITEM(linked_item.getObject())->geometricBounds(); + if (bbox && preserve_position) { + origin = (*bbox).corner(0); + } } } } diff --git a/src/live_effects/lpe-clone-original.h b/src/live_effects/lpe-clone-original.h index 0ff5eb01d..e4328c169 100644 --- a/src/live_effects/lpe-clone-original.h +++ b/src/live_effects/lpe-clone-original.h @@ -46,6 +46,7 @@ private: BoolParam filter; TextParam attributes; TextParam style_attributes; + Geom::Point origin; bool preserve_position_changed; bool expanded; Gtk::Expander * expander; |
