diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-09-12 14:43:47 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-09-12 14:43:47 +0000 |
| commit | 1fa0c72b664afa4803dffd463ed11ce01632ab76 (patch) | |
| tree | c1f746d4e8f7a5d65541cf6c05d3cdc79b3f9c10 /src/document.cpp | |
| parent | Fix preferences crash (diff) | |
| download | inkscape-1fa0c72b664afa4803dffd463ed11ce01632ab76.tar.gz inkscape-1fa0c72b664afa4803dffd463ed11ce01632ab76.zip | |
New option to invert y-axis
Replaces all hard coded or implicit desktop coordinate usage with
doc2dt multiplication.
New global preference: Interface > Origin at upper left
https://bugs.launchpad.net/inkscape/+bug/170049
Diffstat (limited to '')
| -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); } } |
