aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/Slider.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-03-14 14:00:47 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-03-14 14:00:47 +0100
commit296348b5bc983112e2d4399c73d5f64e4e736dae (patch)
treea4cb3eacaab35989122f3081a0854d639adecfa6 /src/GraphicObjects/Slider.cs
parent2c8ebf731af0a626c5d684efc5c2853edd8c3c2d (diff)
slider small increment accuracy
Diffstat (limited to 'src/GraphicObjects/Slider.cs')
-rw-r--r--src/GraphicObjects/Slider.cs26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs
index 59eb99ec..4492c406 100644
--- a/src/GraphicObjects/Slider.cs
+++ b/src/GraphicObjects/Slider.cs
@@ -215,11 +215,27 @@ namespace Crow
}
public override void onMouseMove (object sender, MouseMoveEventArgs e)
{
- if (holdCursor) {
- if (_orientation == Orientation.Horizontal)
- Value += (double)e.XDelta / unity;
- else
- Value += (double)e.YDelta / unity;
+ if (holdCursor) {
+ Point m = ScreenPointToLocal (e.Position);
+ Rectangle r = ClientRectangle;
+
+ if (_orientation == Orientation.Horizontal) {
+ if (r.Width - _cursorSize == 0)
+ return;
+ double unit = (Maximum - Minimum) / (double)(r.Width - _cursorSize);
+ double tmp = (double)m.X * unit;
+ tmp -= tmp % SmallIncrement;
+ Value = tmp;
+ } else {
+ if (r.Height - _cursorSize == 0)
+ return;
+ double unit = (Maximum - Minimum) / (double)(r.Height - _cursorSize);
+ double tmp = (double)m.Y * unit;
+ tmp -= tmp % SmallIncrement;
+ Value = tmp;
+ }
+
+
}
base.onMouseMove (sender, e);