New: CPEvent scrollingDeltaX, scrollingDeltaY and hasPreciseScrollingDeltas.

Refs #2013.
This commit is contained in:
Alexander Ljungberg
2014-07-23 15:00:30 +01:00
parent 81f9748313
commit 7470f4ffcf
2 changed files with 32 additions and 0 deletions
+30
View File
@@ -68,6 +68,9 @@ var _CPEventPeriodicEventPeriod = 0,
float _deltaX;
float _deltaY;
float _deltaZ;
float _scrollingDeltaX;
float _scrollingDeltaY;
BOOL _hasPreciseScrollingDeltas;
#if PLATFORM(DOM)
BOOL _suppressCappuccinoCut;
@@ -163,7 +166,9 @@ var _CPEventPeriodicEventPeriod = 0,
// Make sure these are 0 rather than nil.
_deltaX = 0;
_scrollingDeltaX = 0;
_deltaY = 0;
_scrollingDeltaY = 0;
_deltaZ = 0;
}
@@ -417,6 +422,31 @@ var _CPEventPeriodicEventPeriod = 0,
return _deltaZ;
}
- (BOOL)hasPreciseScrollingDeltas
{
return !!_hasPreciseScrollingDeltas;
}
/*!
Returns the change in points on the x-axis for a mouse movement, unless hasPreciseScrollingDeltas is NO,
in which case the change is measured in number of "lines" or "rows" and needs to be multiplied as appropriate
to get change in pixels.
*/
- (float)scrollingDeltaX
{
return _scrollingDeltaX;
}
/*!
Returns the change in points on the y-axis for a mouse movement, unless hasPreciseScrollingDeltas is NO,
in which case the change is measured in number of "lines" or "columns" and needs to be multiplied as appropriate
to get change in pixels.
*/
- (float)scrollingDeltaY
{
return _scrollingDeltaY;
}
- (BOOL)_triggersKeyEquivalent:(CPString)aKeyEquivalent withModifierMask:aKeyEquivalentModifierMask
{
if (!aKeyEquivalent)
+2
View File
@@ -21,6 +21,8 @@
[self assert:0 equals:[anEvent deltaX] message:"default event delta X should be 0"];
[self assert:0 equals:[anEvent deltaY] message:"default event delta Y should be 0"];
[self assert:0 equals:[anEvent deltaZ] message:"default event delta Z should be 0"];
[self assert:0 equals:[anEvent scrollingDeltaX] message:"default event scrolling delta X should be 0"];
[self assert:0 equals:[anEvent scrollingDeltaY] message:"default event scrolling delta Y should be 0"];
}
- (void)testDescription