diff options
Diffstat (limited to 'src/sp-item-group.cpp')
| -rw-r--r-- | src/sp-item-group.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index a2eda6625..1b3a53828 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -50,6 +50,8 @@ #include "sp-switch.h" #include "sp-defs.h" #include "verbs.h" +#include "layer-model.h" +#include "selection-chemistry.h" using Inkscape::DocumentUndo; @@ -561,6 +563,35 @@ void SPGroup::translateChildItems(Geom::Translate const &tr) } } +// Recursively scale child items around a point +void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p) +{ + if ( hasChildren() ) { + for (SPObject *o = firstChild() ; o ; o = o->getNext() ) { + if ( SP_IS_ITEM(o) ) { + if (SP_IS_GROUP(o)) { + SP_GROUP(o)->scaleChildItemsRec(sc, p); + } else { + SPItem *item = reinterpret_cast<SPItem *>(o); + Geom::OptRect bbox = item->desktopVisualBounds(); + if (bbox) { + // Clear selection (TODO: save and restore selection) + sp_desktop_selection(SP_ACTIVE_DESKTOP)->clear(); + + // Scale item + Geom::Translate const s(p); + Geom::Affine final = s.inverse() * sc * s; + Inkscape::LayerModel layers = Inkscape::LayerModel(); + Inkscape::Selection selection(&layers, SP_ACTIVE_DESKTOP); + selection.add(item); + sp_selection_apply_affine(&selection, final, true, true); + } + } + } + } + } +} + CGroup::CGroup(SPGroup *group) { _group = group; } |
