lundi 18 avril 2016

bouncing caused by unlocking if statement VB.NET

Is there a solution that would generate a better output to my VB.NET if statement. I tried to keep it from locking by setting it to the min and max values while under or over these values. It works but the output is not so charming, ie the values are bouncing back and forth.

        If MouseButtons = 1048576 Then                      ' On mouse down (within loop)
        If Track >= TrackMin AndAlso Track <= TrackMax Then ' Evaluate and integrate mouse position if in range
            Track = Poslast + (Yabs - SampleMouse)      ' Do it

        ElseIf Track < TrackMin Then                    ' If smaller than Trackmin  
            Track = TrackMin                            ' Use TrackMin to avoid locking if statement
        ElseIf Track > TrackMax Then                    ' If Greater than TrackMax
            Track = TrackMax                            ' Use TrackMax to avoid locking if statement
        End If
    End If

Aucun commentaire:

Enregistrer un commentaire