From: Mikko Rasa Date: Sun, 20 Jan 2013 11:58:28 +0000 (+0200) Subject: Fix elevation mode in Manipulator X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=abc0c5d8d150dafcf61aa522d56b2a36ee662229;p=r2c2.git Fix elevation mode in Manipulator I didn't get it quite right when converting the input event handling --- diff --git a/source/designer/manipulator.cpp b/source/designer/manipulator.cpp index d1e458b..83a093a 100644 --- a/source/designer/manipulator.cpp +++ b/source/designer/manipulator.cpp @@ -48,6 +48,8 @@ void Manipulator::start_elevate() cancel(); mode = ELEVATE; + + elev_origin = pointer.y; } bool Manipulator::start_extend() @@ -361,7 +363,7 @@ void Manipulator::button_press(unsigned btn) } } -void Manipulator::axis_motion(unsigned axis, float value, float change) +void Manipulator::axis_motion(unsigned axis, float value, float) { if(axis==0) pointer.x = value; @@ -428,7 +430,7 @@ void Manipulator::axis_motion(unsigned axis, float value, float change) } else if(mode==ELEVATE && axis==1) { - float dz = -change; + float dz = pointer.y-elev_origin; signal_status.emit(format("Elevation: %+.0fmm (%.0fmm)", dz*1000, (center.z+dz)*1000)); diff --git a/source/designer/manipulator.h b/source/designer/manipulator.h index 469f09f..b4216ee 100644 --- a/source/designer/manipulator.h +++ b/source/designer/manipulator.h @@ -52,6 +52,7 @@ private: R2C2::Vector move_origin; float angle; float rot_origin; + float elev_origin; std::set neighbors; std::vector extend_tracks;