]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/smoothcontrol.cpp
Keep track of edges in Control
[libs/gui.git] / source / input / smoothcontrol.cpp
index 6f4f5a487857deebe9fdaeaec277def92126937e..3218753157628fc477c968acaa7a692673913b1d 100644 (file)
@@ -87,6 +87,7 @@ void SmoothControl::on_release()
 
 void SmoothControl::on_motion(float v, float r)
 {
+       float old_value = value;
        if(v<-dead_zone)
                value = v+dead_zone;
        else if(v>dead_zone)
@@ -104,6 +105,11 @@ void SmoothControl::on_motion(float v, float r)
                        value /= threshold-dead_zone;
        }
 
+       if(value && !old_value)
+               rising_edge = true;
+       else if(!value && old_value)
+               falling_edge = true;
+
        signal_motion.emit(value);
 
        if(paired_ctrl && (v>0 || (v==0 && paired_ctrl->value!=0)))