From f709f7f377a37c2bec986965d5b0709675ef4538 Mon Sep 17 00:00:00 2001 From: Stephen Silver Date: Sat, 31 May 2008 15:16:57 +0000 Subject: wrtlprnft's patch for bug 234834 - keeps guidelines in same position relative to objects when doing "Fit page to selection", and also keeps the objects in the same position on the screen (bzr r5771) --- src/document.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index d0792ab8a..bf5ef089e 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -48,6 +48,8 @@ #include "inkscape-private.h" #include "inkscape_version.h" #include "sp-object-repr.h" +#include "sp-namedview.h" +#include "desktop.h" #include "document-private.h" #include "dir-util.h" #include "unit-constants.h" @@ -557,6 +559,14 @@ void SPDocument::fitToRect(NR::Rect const &rect) NR::translate const tr(NR::Point(0, (old_height - h)) - rect.min()); SP_GROUP(root)->translateChildItems(tr); + SPNamedView *nv = sp_document_namedview(this, 0); + if(nv) { + NR::translate tr2(-rect.min()); + nv->translateGuides(tr2); + + // update the viewport so the drawing appears to stay where it was + nv->scrollAllDesktops(-tr2[0], tr2[1], false); + } } void sp_document_set_uri(SPDocument *document, gchar const *uri) -- cgit v1.2.3