diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-01-26 19:50:49 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-01-26 19:50:49 +0000 |
| commit | 6e1d8f71fe292882f34186ac5ff57b25c658b96f (patch) | |
| tree | 51d3c18a6390858673cc31f466358985e8e09651 /src/selection-chemistry.cpp | |
| parent | reset center coords to zero when there's no attribute (diff) | |
| download | inkscape-6e1d8f71fe292882f34186ac5ff57b25c658b96f.tar.gz inkscape-6e1d8f71fe292882f34186ac5ff57b25c658b96f.zip | |
transform centers in sp_selection_apply_affine, comments
(bzr r36)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index ee64e87ec..0ba60a91c 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1167,6 +1167,12 @@ void sp_selection_to_prev_layer () g_slist_free ((GSList *) items); } +/** Apply matrix to the selection. \a set_i2d is normally true, which means objects are in the +original transform, synced with their reprs, and need to jump to the new transform in one go. A +value of set_i2d==false is only used by seltrans when it's dragging objects live (not outlines); in +that case, items are already in the new position, but the repr is in the old, and this function +then simply updates the repr from item->transform. + */ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const &affine, bool set_i2d) { if (selection->isEmpty()) @@ -1175,6 +1181,10 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { SPItem *item = SP_ITEM(l->data); + NR::Point old_center(0,0); + if (set_i2d && item->isCenterSet()) + old_center = item->getCenter(); + #if 0 /* Re-enable this once persistent guides have a graphical indication. At the time of writing, this is the only place to re-enable. */ sp_item_update_cns(*item, selection->desktop()); @@ -1254,6 +1264,13 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const } sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL); } + + // if we're moving the actual object, not just updating the repr, we can transform the + // center by the same matrix (only necessary for non-translations) + if (set_i2d && item->isCenterSet() && !affine.is_translation()) { + item->setCenter(old_center * affine); + SP_OBJECT(item)->updateRepr(); + } } } |
