diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-02-11 15:16:11 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-02-11 15:16:11 +0000 |
| commit | b2eba12ae847ce5ba16e456fd156231cd200b644 (patch) | |
| tree | 88bec9af6a1921a707d7e08b26d325229d33208c /src/ui | |
| parent | Remove artifacts when remove canvas items, for example in measure tool (diff) | |
| download | inkscape-b2eba12ae847ce5ba16e456fd156231cd200b644.tar.gz inkscape-b2eba12ae847ce5ba16e456fd156231cd200b644.zip | |
Fix a bug on explicit_base on meassure tool when using knots dialog to change position
(bzr r14646)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/tools/measure-tool.cpp | 22 | ||||
| -rw-r--r-- | src/ui/tools/measure-tool.h | 2 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index dedea8fc1..a2a440ef4 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -335,6 +335,8 @@ void createAngleDisplayCurve(SPDesktop *desktop, Geom::Point const ¢er, Geom } // namespace +boost::optional<Geom::Point> explicit_base_tmp = boost::none; + MeasureTool::MeasureTool() : ToolBase(cursor_measure_xpm, 4, 4) , grabbed(NULL) @@ -369,7 +371,6 @@ MeasureTool::MeasureTool() writeMeasurePoint(start_p, true); writeMeasurePoint(end_p, false); } - this->_knot_start_moved_connection = this->knot_start->moved_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotStartMovedHandler)); this->_knot_start_click_connection = this->knot_start->click_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotClickHandler)); this->_knot_start_ungrabbed_connection = this->knot_start->ungrabbed_signal.connect(sigc::mem_fun(*this, &MeasureTool::knotUngrabbedHandler)); @@ -458,6 +459,7 @@ void MeasureTool::knotClickHandler(SPKnot *knot, guint state) SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring const unit_name = prefs->getString("/tools/measure/unit"); + explicit_base = explicit_base_tmp; Inkscape::UI::Dialogs::KnotPropertiesDialog::showDialog(desktop, knot, unit_name); } } @@ -560,7 +562,8 @@ bool MeasureTool::root_handler(GdkEvent* event) this->knot_start->hide(); this->knot_end->hide(); Geom::Point const button_w(event->button.x, event->button.y); - explicitBase = boost::none; + explicit_base = boost::none; + explicit_base_tmp = boost::none; last_end = boost::none; start_p = desktop->w2d(button_w); @@ -585,7 +588,8 @@ bool MeasureTool::root_handler(GdkEvent* event) } case GDK_KEY_PRESS: { if ((event->key.keyval == GDK_KEY_Shift_L) || (event->key.keyval == GDK_KEY_Shift_R)) { - explicitBase = end_p; + explicit_base_tmp = explicit_base; + explicit_base = end_p; } break; } @@ -741,9 +745,9 @@ void MeasureTool::toGuides() return; } setGuide(start,ray.angle(), _("Measure")); - if(explicitBase) { - explicitBase = *explicitBase * SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); - ray.setPoints(start, *explicitBase); + if(explicit_base) { + explicit_base = *explicit_base * SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); + ray.setPoints(start, *explicit_base); if(ray.angle() != 0) { setGuide(start,ray.angle(), _("Base")); } @@ -1153,8 +1157,8 @@ void MeasureTool::showCanvasItems(bool to_guides, bool to_item, bool to_phantom, double angle = atan2(end_p - start_p); double baseAngle = 0; - if (explicitBase) { - baseAngle = atan2(explicitBase.get() - start_p); + if (explicit_base) { + baseAngle = atan2(explicit_base.get() - start_p); angle -= baseAngle; } @@ -1304,7 +1308,7 @@ void MeasureTool::showCanvasItems(bool to_guides, bool to_item, bool to_phantom, double length = std::abs((end_p - start_p).length()); Geom::Point anchorEnd = start_p; anchorEnd[Geom::X] += length; - if (explicitBase) { + if (explicit_base) { anchorEnd *= (Geom::Affine(Geom::Translate(-start_p)) * Geom::Affine(Geom::Rotate(baseAngle)) * Geom::Affine(Geom::Translate(start_p))); diff --git a/src/ui/tools/measure-tool.h b/src/ui/tools/measure-tool.h index f36578d38..14fc9f81a 100644 --- a/src/ui/tools/measure-tool.h +++ b/src/ui/tools/measure-tool.h @@ -68,7 +68,7 @@ public: void knotUngrabbedHandler(SPKnot */*knot*/, unsigned int /*state*/); private: SPCanvasItem* grabbed; - boost::optional<Geom::Point> explicitBase; + boost::optional<Geom::Point> explicit_base; boost::optional<Geom::Point> last_end; SPKnot *knot_start; SPKnot *knot_end; |
