Fix for issue 1210

This commit is contained in:
Nathaniel Martin committed 2011-04-06 23:16:13 -07:00
1 parent 6b64291690
commit 875dbaa78f
2 files changed
+14 -4

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ var PrimaryPlatformWindow = NULL;
BOOL _mouseIsDown;
BOOL _mouseDownIsRightClick;
CGPoint _mouseDragStart;
CPWindow _mouseDownWindow;
CPTimeInterval _lastMouseUp;
CPTimeInterval _lastMouseDown;
+13 -4
View File
@@ -204,6 +204,7 @@ var ModifierKeyCodes = [
_windowLevels = [];
_windowLayers = [CPDictionary dictionary];
[self registerDOMWindow];
[self updateFromNativeContentRect];
@@ -1202,7 +1203,7 @@ var ModifierKeyCodes = [
{
if (_mouseIsDown)
{
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseDownIsRightClick ? CPRightMouseUp : CPLeftMouseUp, location, modifierFlags, timestamp, windowNumber, nil, -1, CPDOMEventGetClickCount(_lastMouseUp, timestamp, location), 0);
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseDownIsRightClick ? CPRightMouseUp : CPLeftMouseUp, location, modifierFlags, timestamp, windowNumber, nil, -1, CPDOMEventGetClickCount(_lastMouseUp, timestamp, location), 0, nil);
_mouseIsDown = NO;
_lastMouseUp = event;
@@ -1220,6 +1221,7 @@ var ModifierKeyCodes = [
else if (type === "mousedown")
{
var button = aDOMEvent.button;
_mouseDragStart = location;
_mouseDownIsRightClick = button == 2 || (CPBrowserIsOperatingSystem(CPMacOperatingSystem) && button == 0 && modifierFlags & CPControlKeyMask);
if (sourceElement.tagName === "INPUT" && sourceElement != _DOMFocusElement)
@@ -1252,7 +1254,7 @@ var ModifierKeyCodes = [
StopContextMenuDOMEventPropagation = YES;
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseDownIsRightClick ? CPRightMouseDown : CPLeftMouseDown, location, modifierFlags, timestamp, windowNumber, nil, -1, CPDOMEventGetClickCount(_lastMouseDown, timestamp, location), 0);
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseDownIsRightClick ? CPRightMouseDown : CPLeftMouseDown, location, modifierFlags, timestamp, windowNumber, nil, -1, CPDOMEventGetClickCount(_lastMouseDown, timestamp, location), 0, nil);
_mouseIsDown = YES;
_lastMouseDown = event;
@@ -1263,7 +1265,8 @@ var ModifierKeyCodes = [
if (_DOMEventMode)
return;
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseIsDown ? (_mouseDownIsRightClick ? CPRightMouseDragged : CPLeftMouseDragged) : CPMouseMoved, location, modifierFlags, timestamp, windowNumber, nil, -1, 1, 0);
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseIsDown ? (_mouseDownIsRightClick ? CPRightMouseDragged : CPLeftMouseDragged) : CPMouseMoved, location, modifierFlags, timestamp, windowNumber, nil, -1, 1, 0, _mouseDragStart);
_mouseDragStart = location;
}
var isDragging = [[CPDragServer sharedDragServer] isDragging];
@@ -1545,7 +1548,7 @@ var ModifierKeyCodes = [
var CPEventClass = [CPEvent class];
var _CPEventFromNativeMouseEvent = function(aNativeEvent, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, anEventNumber, aClickCount, aPressure)
var _CPEventFromNativeMouseEvent = function(aNativeEvent, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, anEventNumber, aClickCount, aPressure, aMouseDragStart)
{
aNativeEvent.isa = CPEventClass;
@@ -1559,6 +1562,12 @@ var _CPEventFromNativeMouseEvent = function(aNativeEvent, anEventType, aPoint, m
aNativeEvent._eventNumber = anEventNumber;
aNativeEvent._clickCount = aClickCount;
aNativeEvent._pressure = aPressure;
if((anEventType == CPLeftMouseDragged) || (anEventType == CPRightMouseDragged))
{
aNativeEvent._deltaX = aPoint.x - aMouseDragStart.x;
aNativeEvent._deltaY = aPoint.y - aMouseDragStart.y;
}
return aNativeEvent;
}