mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-17 04:00:42 +00:00
Fixed: touch scrolling events to scrollviews also scrolled the document body (#2750)
This commit is contained in:
1 parent
78524cdde7
commit
fa6177b56d
1 file changed
+12
-5
@@ -427,10 +427,10 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
|
||||
theDocument.addEventListener("keydown", keyEventCallback, NO);
|
||||
theDocument.addEventListener("keypress", keyEventCallback, NO);
|
||||
|
||||
theDocument.addEventListener("touchstart", touchEventCallback, NO);
|
||||
theDocument.addEventListener("touchend", touchEventCallback, NO);
|
||||
theDocument.addEventListener("touchmove", touchEventCallback, NO);
|
||||
theDocument.addEventListener("touchcancel", touchEventCallback, NO);
|
||||
theDocument.addEventListener("touchstart", touchEventCallback, {passive: false});
|
||||
theDocument.addEventListener("touchend", touchEventCallback, {passive: false});
|
||||
theDocument.addEventListener("touchmove", touchEventCallback, {passive: false});
|
||||
theDocument.addEventListener("touchcancel", touchEventCallback, {passive: false});
|
||||
|
||||
_DOMWindow.addEventListener("DOMMouseScroll", scrollEventCallback, NO);
|
||||
_DOMWindow.addEventListener("wheel", scrollEventCallback, NO);
|
||||
@@ -1180,6 +1180,12 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
|
||||
// two fingers->simulate scrolling events
|
||||
if (aDOMEvent.touches && aDOMEvent.touches.length == 2)
|
||||
{
|
||||
if (aDOMEvent.preventDefault)
|
||||
aDOMEvent.preventDefault();
|
||||
|
||||
if (aDOMEvent.stopPropagation)
|
||||
aDOMEvent.stopPropagation();
|
||||
|
||||
switch (aDOMEvent.type)
|
||||
{
|
||||
case CPDOMEventTouchStart:
|
||||
@@ -1199,7 +1205,8 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
|
||||
return;
|
||||
}
|
||||
}
|
||||
// handle other touch cases specifically
|
||||
|
||||
// cancel other touch cases preventively
|
||||
|
||||
if (aDOMEvent.preventDefault)
|
||||
aDOMEvent.preventDefault();
|
||||
|
||||
Reference in new issue
Block a user