]> git.tdb.fi Git - r2c2.git/commitdiff
Fix elevation mode in Manipulator
authorMikko Rasa <tdb@tdb.fi>
Sun, 20 Jan 2013 11:58:28 +0000 (13:58 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 20 Jan 2013 11:58:28 +0000 (13:58 +0200)
I didn't get it quite right when converting the input event handling

source/designer/manipulator.cpp
source/designer/manipulator.h

index d1e458baed645445fd11f1853b2fb377e0632bc6..83a093a712d77fb98949c1852fadcd6da15b7f1a 100644 (file)
@@ -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));
 
index 469f09f769fe5a768ad40c3501d0ff6f454a91d2..b4216eefd52354f1d6c6aedacc2cf87290afa49a 100644 (file)
@@ -52,6 +52,7 @@ private:
        R2C2::Vector move_origin;
        float angle;
        float rot_origin;
+       float elev_origin;
        std::set<R2C2::Track *> neighbors;
        std::vector<R2C2::Track *> extend_tracks;