diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-12 16:02:57 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-12 16:02:57 +0000 |
| commit | 197d4156fb11ec3e608d04e656a7b9e841c341d8 (patch) | |
| tree | 148f0e5a97cac35451983625eb028f94fc4556d0 /src/object/sp-guide.cpp | |
| parent | More caching in prefs (diff) | |
| parent | Allow adding new properties (diff) | |
| download | inkscape-197d4156fb11ec3e608d04e656a7b9e841c341d8.tar.gz inkscape-197d4156fb11ec3e608d04e656a7b9e841c341d8.zip | |
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'src/object/sp-guide.cpp')
| -rw-r--r-- | src/object/sp-guide.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/object/sp-guide.cpp b/src/object/sp-guide.cpp index 0b8558230..acb0707d0 100644 --- a/src/object/sp-guide.cpp +++ b/src/object/sp-guide.cpp @@ -131,6 +131,12 @@ void SPGuide::set(unsigned int key, const gchar *value) { g_strfreev (strarray); if (success == 2 && (fabs(newx) > 1e-6 || fabs(newy) > 1e-6)) { Geom::Point direction(newx, newy); + + // <sodipodi:guide> stores inverted y-axis coordinates + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + direction[Geom::Y] *= -1.0; + } + direction.normalize(); this->normal_to_line = direction; } else { @@ -176,6 +182,11 @@ void SPGuide::set(unsigned int key, const gchar *value) { this->point_on_line = Geom::Point(newx, 0); } } + + // <sodipodi:guide> stores inverted y-axis coordinates + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + this->point_on_line[Geom::Y] = document->getHeight().value("px") - this->point_on_line[Geom::Y]; + } } else { // default to (0,0) for bad arguments this->point_on_line = Geom::Point(0,0); @@ -217,6 +228,12 @@ SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::P } } + // <sodipodi:guide> stores inverted y-axis coordinates + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + newy = doc->getHeight().value("px") - newy; + n[Geom::Y] *= -1.0; + } + sp_repr_set_point(repr, "position", Geom::Point( newx, newy )); sp_repr_set_point(repr, "orientation", n); @@ -368,6 +385,11 @@ void SPGuide::moveto(Geom::Point const point_on_line, bool const commit) double newx = point_on_line.x(); double newy = point_on_line.y(); + // <sodipodi:guide> stores inverted y-axis coordinates + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + newy = document->getHeight().value("px") - newy; + } + SPRoot *root = document->getRoot(); if( root->viewBox_set ) { // check to see if scaling is uniform @@ -414,7 +436,14 @@ void SPGuide::set_normal(Geom::Point const normal_to_line, bool const commit) case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */ if (commit) { //XML Tree being used directly while it shouldn't be - sp_repr_set_point(getRepr(), "orientation", normal_to_line); + auto normal = normal_to_line; + + // <sodipodi:guide> stores inverted y-axis coordinates + if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->is_yaxisdown()) { + normal[Geom::Y] *= -1.0; + } + + sp_repr_set_point(getRepr(), "orientation", normal); } /* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan) |
