From 1fa0c72b664afa4803dffd463ed11ce01632ab76 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Wed, 12 Sep 2018 16:43:47 +0200 Subject: 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 --- src/object/box3d.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/object/box3d.cpp') diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp index df95f4f84..7be7c10f7 100644 --- a/src/object/box3d.cpp +++ b/src/object/box3d.cpp @@ -149,6 +149,9 @@ void SPBox3D::set(unsigned int key, const gchar* value) { case SP_ATTR_INKSCAPE_BOX3D_CORNER0: if (value && strcmp(value, "0 : 0 : 0 : 0")) { box->orig_corner0 = Proj::Pt3(value); + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + box->orig_corner0[Proj::Y] *= -1; + } box->save_corner0 = box->orig_corner0; box3d_position_set(box); } @@ -156,6 +159,9 @@ void SPBox3D::set(unsigned int key, const gchar* value) { case SP_ATTR_INKSCAPE_BOX3D_CORNER7: if (value && strcmp(value, "0 : 0 : 0 : 0")) { box->orig_corner7 = Proj::Pt3(value); + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + box->orig_corner7[Proj::Y] *= -1; + } box->save_corner7 = box->orig_corner7; box3d_position_set(box); } @@ -227,8 +233,15 @@ Inkscape::XML::Node* SPBox3D::write(Inkscape::XML::Document *xml_doc, Inkscape:: } } - gchar *coordstr0 = box->orig_corner0.coord_string(); - gchar *coordstr7 = box->orig_corner7.coord_string(); + auto corner0 = box->orig_corner0; + auto corner7 = box->orig_corner7; + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + corner0[Proj::Y] *= -1; + corner7[Proj::Y] *= -1; + } + + gchar *coordstr0 = corner0.coord_string(); + gchar *coordstr7 = corner7.coord_string(); repr->setAttribute("inkscape:corner0", coordstr0); repr->setAttribute("inkscape:corner7", coordstr7); g_free(coordstr0); -- cgit v1.2.3