From 63203fb881bfce667a14b2bbb3ec2ee40a9adf77 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sat, 27 Jul 2019 14:40:29 +0000 Subject: Make doc2dt a document property Closes #340 --- src/document.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/document.h') diff --git a/src/document.h b/src/document.h index 609d665bc..fd7e15fc5 100644 --- a/src/document.h +++ b/src/document.h @@ -29,6 +29,7 @@ #include #include +#include <2geom/affine.h> #include <2geom/forward.h> #include "3rdparty/libcroco/cr-cascade.h" @@ -390,7 +391,22 @@ private: sigc::signal destroySignal; + mutable Geom::Affine _doc2dt; + public: + /// Document to desktop coordinate transformation. + const Geom::Affine &doc2dt() const; + /// Desktop to document coordinate transformation. + const Geom::Affine &dt2doc() const + { + // Note: doc2dt().inverse() happens to be identical to doc2dt() + return doc2dt(); + } + /// True if the desktop Y-axis points down, false if it points up. + bool is_yaxisdown() const { return yaxisdir() > 0; } + /// "1" if the desktop Y-axis points down, "-1" if it points up. + double yaxisdir() const { return _doc2dt[3]; } + void addUndoObserver(Inkscape::UndoStackObserver& observer); void removeUndoObserver(Inkscape::UndoStackObserver& observer); -- cgit v1.2.3