* Improved VolumeControl snapping based on Stippi's snapping code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2009, Haiku, Inc.
|
* Copyright 2003-2010, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -223,14 +223,22 @@ VolumeControl::MouseMoved(BPoint where, uint32 transit,
|
|||||||
if (ModificationMessage() != NULL)
|
if (ModificationMessage() != NULL)
|
||||||
Messenger().SendMessage(ModificationMessage());
|
Messenger().SendMessage(ModificationMessage());
|
||||||
|
|
||||||
|
float snapPoint = _PointForValue(0);
|
||||||
|
const float kMinSnapOffset = 6;
|
||||||
|
|
||||||
if (oldValue > newValue) {
|
if (oldValue > newValue) {
|
||||||
// movement from right to left
|
// movement from right to left
|
||||||
fMinSnap = _PointForValue(-4);
|
fMinSnap = _PointForValue(-4);
|
||||||
|
if (fabs(snapPoint - fMinSnap) < kMinSnapOffset)
|
||||||
|
fMinSnap = snapPoint - kMinSnapOffset;
|
||||||
|
|
||||||
fMaxSnap = _PointForValue(1);
|
fMaxSnap = _PointForValue(1);
|
||||||
} else {
|
} else {
|
||||||
// movement from left to right
|
// movement from left to right
|
||||||
fMinSnap = _PointForValue(-1);
|
fMinSnap = _PointForValue(-1);
|
||||||
fMaxSnap = _PointForValue(4);
|
fMaxSnap = _PointForValue(4);
|
||||||
|
if (fabs(snapPoint - fMaxSnap) < kMinSnapOffset)
|
||||||
|
fMaxSnap = snapPoint + kMinSnapOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
fSnapping = true;
|
fSnapping = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user