diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-09-23 16:08:52 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-09-23 16:08:52 +0000 |
| commit | 78c3478e08ea6c33fbf265d8f22b02fa99660d8a (patch) | |
| tree | a14d571ad2dbfdf5a3f08d03c0d215e0785d1cb8 /src | |
| parent | Inkscapestream: Incredible speed up for writing of strings (diff) | |
| download | inkscape-78c3478e08ea6c33fbf265d8f22b02fa99660d8a.tar.gz inkscape-78c3478e08ea6c33fbf265d8f22b02fa99660d8a.zip | |
fix "Arrange" dialog with inverted y-axis
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/sp-item.cpp | 12 | ||||
| -rw-r--r-- | src/ui/dialog/grid-arrange-tab.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/polar-arrange-tab.cpp | 10 |
3 files changed, 9 insertions, 18 deletions
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 0a8af14dc..57cbfcd4e 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -262,7 +262,7 @@ bool SPItem::isCenterSet() const { return (transform_center_x != 0 || transform_center_y != 0); } -// Get the item's transformation center in document coordinates (i.e. in pixels) +// Get the item's transformation center in desktop coordinates (i.e. in pixels) Geom::Point SPItem::getCenter() const { document->ensureUpToDate(); @@ -1614,19 +1614,15 @@ Geom::Affine SPItem::i2doc_affine() const Geom::Affine SPItem::i2dt_affine() const { - Geom::Affine ret; + Geom::Affine ret(i2doc_affine()); SPDesktop const *desktop = SP_ACTIVE_DESKTOP; if ( desktop ) { - ret = i2doc_affine() * desktop->doc2dt(); - } else { - // TODO temp code to prevent crashing on command-line launch: - ret = i2doc_affine() - * Geom::Scale(1, -1) - * Geom::Translate(0, document->getHeight().value("px")); + ret *= desktop->doc2dt(); } return ret; } +// TODO should be named "set_i2dt_affine" void SPItem::set_i2d_affine(Geom::Affine const &i2dt) { Geom::Affine dt2p; /* desktop to item parent transform */ diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 91e93de93..4b3dce298 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -324,10 +324,9 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h new_x = grid_left + (((col_widths[col] - width)/2)*HorizAlign) + col_xs[col]; new_y = grid_top + (((row_heights[row] - height)/2)*VertAlign) + row_ys[row]; - // signs are inverted between x and y due to y inversion - Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y); + Geom::Point move = Geom::Point(new_x, new_y) - min; Geom::Affine const affine = Geom::Affine(Geom::Translate(move)); - item->set_i2d_affine(item->i2dt_affine() * affine); + item->set_i2d_affine(item->i2doc_affine() * affine * SP_ACTIVE_DESKTOP->doc2dt()); item->doWriteTransform(item->transform); item->updateRepr(); cnt +=1; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 49b5a5790..a44218f07 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -184,11 +184,9 @@ static Geom::Point calcPoint(float cx, float cy, float rx, float ry, float angle } /** - * Returns the selected anchor point in document coordinates. If anchor + * Returns the selected anchor point in desktop coordinates. If anchor * is 0 to 8, then a bounding box point has been chosen. If it is 9 however * the rotational center is chosen. - * @todo still using a hack to get the real coordinate space (subtracting document height - * and inverting axes) */ static Geom::Point getAnchorPoint(int anchor, SPItem *item) { @@ -237,11 +235,9 @@ static Geom::Point getAnchorPoint(int anchor, SPItem *item) // If using center if(anchor == 9) source = item->getCenter(); - else + else if (SP_ACTIVE_DESKTOP) { - // FIXME: - source[1] -= item->document->getHeight().value("px"); - source[1] *= -1; + source *= SP_ACTIVE_DESKTOP->doc2dt(); } return source; |
