diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-12 16:02:57 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-12 16:02:57 +0000 |
| commit | 197d4156fb11ec3e608d04e656a7b9e841c341d8 (patch) | |
| tree | 148f0e5a97cac35451983625eb028f94fc4556d0 /src/document.cpp | |
| parent | More caching in prefs (diff) | |
| parent | Allow adding new properties (diff) | |
| download | inkscape-197d4156fb11ec3e608d04e656a7b9e841c341d8.tar.gz inkscape-197d4156fb11ec3e608d04e656a7b9e841c341d8.zip | |
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/document.cpp b/src/document.cpp index 658bc93c9..d4094b7e9 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -841,6 +841,12 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) margin_bottom = Inkscape::Util::Quantity::convert(margin_bottom, nv_units, "px"); } } + + double y_dir = SP_ACTIVE_DESKTOP->yaxisdir(); + + if (y_dir > 0) { + std::swap(margin_top, margin_bottom); + } Geom::Rect const rect_with_margins( rect.min() - Geom::Point(margin_left, margin_bottom), @@ -852,7 +858,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) ); Geom::Translate const tr( - Geom::Point(0, old_height - rect_with_margins.height()) + Geom::Point(0, (y_dir > 0) ? 0 : old_height - rect_with_margins.height()) - rect_with_margins.min()); root->translateChildItems(tr); @@ -862,7 +868,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) nv->translateGrids(tr2); // update the viewport so the drawing appears to stay where it was - nv->scrollAllDesktops(-tr2[0], tr2[1], false); + nv->scrollAllDesktops(-tr2[0], -tr2[1] * y_dir, false); } } |
