From: dvlierop2 Date: Sat, 9 May 2009 12:40:32 +0000 (+0000) Subject: When changing document size, the origin (lower left corner) should be stationary... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=386ea3a8ee6db0fca648c5debc9cb82476402294;p=inkscape.git When changing document size, the origin (lower left corner) should be stationary. This way the guides will keep their relative position w.r.t. the objects (bug #167762), and also everything will be redrawn properly (bug #179373) --- diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index cdb0feff3..02688a55e 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -36,6 +36,7 @@ #include "desktop.h" #include "page-sizer.h" #include "helper/action.h" +#include "sp-root.h" using std::pair; @@ -346,8 +347,13 @@ PageSizer::setDim (double w, double h, bool changeList) if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); + double const old_height = sp_document_height(doc); sp_document_set_width (doc, w, &_px_unit); sp_document_set_height (doc, h, &_px_unit); + // The origin for the user is in the lower left corner; this point should remain stationary when + // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this + Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); + SP_GROUP(SP_ROOT(doc->root))->translateChildItems(vert_offset); sp_document_done (doc, SP_VERB_NONE, _("Set page size")); }