From 3d5f0a3d4615973d6bd28884085a5653178cb6dd Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 25 Nov 2014 15:00:58 +0100 Subject: Allow marker orientation to have units ('deg', 'rad', 'grad', 'turn'). (bzr r13757) --- src/sp-marker.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/sp-marker.cpp') diff --git a/src/sp-marker.cpp b/src/sp-marker.cpp index e955594ab..1c13a54e6 100644 --- a/src/sp-marker.cpp +++ b/src/sp-marker.cpp @@ -168,9 +168,12 @@ void SPMarker::set(unsigned int key, const gchar* value) { } else if (!strcmp (value, "auto-start-reverse")) { this->orient_mode = MARKER_ORIENT_AUTO_START_REVERSE; this->orient_set = TRUE; - } else if (sp_svg_number_read_f (value, &this->orient)) { - this->orient_mode = MARKER_ORIENT_ANGLE; - this->orient_set = TRUE; + } else { + orient.readOrUnset(value); + if (orient._set) { + this->orient_mode = MARKER_ORIENT_ANGLE; + this->orient_set = orient._set; + } } } @@ -273,7 +276,7 @@ Inkscape::XML::Node* SPMarker::write(Inkscape::XML::Document *xml_doc, Inkscape: } else if (this->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) { repr->setAttribute("orient", "auto-start-reverse"); } else { - sp_repr_set_css_double(repr, "orient", this->orient); + sp_repr_set_css_double(repr, "orient", this->orient.computed); } } else { repr->setAttribute("orient", NULL); @@ -394,7 +397,7 @@ sp_marker_show_instance ( SPMarker *marker, Inkscape::DrawingItem *parent, m = base; } else { /* fixme: Orient units (Lauris) */ - m = Geom::Rotate::from_degrees(marker->orient); + m = Geom::Rotate::from_degrees(marker->orient.computed); m *= Geom::Translate(base.translation()); } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { -- cgit v1.2.3