diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2014-07-12 13:32:27 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mail@diedenrezi.nl> | 2014-07-12 13:32:27 +0000 |
| commit | f50d13ff0fa4de4abf81251ec855ca0166db9050 (patch) | |
| tree | 9d48b3b6eb96c9c18706b65e5e0af67c6228fa1d /src | |
| parent | scale tiled clones to document units (Bug 1288860) (diff) | |
| download | inkscape-f50d13ff0fa4de4abf81251ec855ca0166db9050.tar.gz inkscape-f50d13ff0fa4de4abf81251ec855ca0166db9050.zip | |
Fix moving of item center: 1) at paste and 2) at changing document units
Fixed bugs:
- https://launchpad.net/bugs/1247799
(bzr r13452)
Diffstat (limited to 'src')
| -rw-r--r-- | src/selection-chemistry.cpp | 7 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 3 | ||||
| -rw-r--r-- | src/sp-item.cpp | 5 | ||||
| -rw-r--r-- | src/sp-item.h | 1 |
4 files changed, 13 insertions, 3 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 868a9d743..f058189d3 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1621,10 +1621,13 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons item->doWriteTransform(item->getRepr(), item->transform, NULL, compensate); } - // if we're moving the actual object, not just updating the repr, we can transform the + // if we're transforming 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.isTranslation() || affine.isIdentity())) { - item->setCenter(old_center * affine); + // If there's a viewbox, we might have an affine with a translation component; + // we will only apply the scaling/skewing components, not the translations + // because otherwise the center will move relative to the item + item->setCenter(old_center * affine.withoutTranslation()); item->updateRepr(); } } diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 2cfe97db8..7af4e3320 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -664,7 +664,8 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p) Geom::Point old_center(0,0); if (item->isCenterSet()) { - old_center = item->getCenter(); + item->scaleCenter(sc.inverse()); // Convert the old relative center position to the new coordinates already now + old_center = item->getCenter(); // because getCenter() will use the bbox midpoint, which is also already in the new coordinates } gchar const *conn_type = NULL; diff --git a/src/sp-item.cpp b/src/sp-item.cpp index b10aae1c6..0cdff6546 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -271,6 +271,11 @@ Geom::Point SPItem::getCenter() const { } } +void +SPItem::scaleCenter(Geom::Scale const &sc) { + transform_center_x *= sc[Geom::X]; + transform_center_y *= sc[Geom::Y]; +} namespace { diff --git a/src/sp-item.h b/src/sp-item.h index d605c99b9..ce93b1d40 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -159,6 +159,7 @@ public: void unsetCenter(); bool isCenterSet() const; Geom::Point getCenter() const; + void scaleCenter(Geom::Scale const &sc); bool isVisibleAndUnlocked() const; |
