From 5d374d672224c6d11a75a65f356f547193faf6fc Mon Sep 17 00:00:00 2001 From: hbomb79 Date: Sun, 7 May 2017 19:56:07 +1200 Subject: [PATCH] Adjusted ScrollContainer:handle to fix CCDrop bugs This function has caused a lot of trouble in the past, especially when dealing with nested ScrollContainers. Keep an eye on this. If you see any weird behavior when dealing with ScrollContainers this change may be the cause --- src/classes/nodes/ScrollContainer.ti | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/classes/nodes/ScrollContainer.ti b/src/classes/nodes/ScrollContainer.ti index ca5c031..7c21aa1 100644 --- a/src/classes/nodes/ScrollContainer.ti +++ b/src/classes/nodes/ScrollContainer.ti @@ -145,32 +145,35 @@ end @return ]] function ScrollContainer:handle( eventObj ) - local cache, isWithin = self.cache, eventObj.isWithin + local cache = self.cache local cloneEv + if not self.super.super:handle( eventObj ) then return end + if self.projector and not self.mirrorProjector and not eventObj.projectorOrigin then self.resolvedProjector:handleEvent( eventObj ) return end if eventObj.main == "MOUSE" then - eventObj.isWithin = eventObj:withinParent( self ) + -- eventObj.isWithin = eventObj:withinParent( self ) if ( not cache.yScrollActive or ( eventObj.X - self.X + 1 ) ~= self.width ) and ( not cache.xScrollActive or ( eventObj.Y - self.Y + 1 ) ~= self.height ) then cloneEv = eventObj:clone( self ) + cloneEv.isWithin = cloneEv.isWithin and eventObj:withinParent( self ) or false cloneEv.Y = cloneEv.Y + self.yScroll cloneEv.X = cloneEv.X + self.xScroll end else cloneEv = eventObj end if cloneEv then self:shipEvent( cloneEv ) end - local r = self.super.super:handle( eventObj ) + -- local r = self.super.super:handle( eventObj ) - eventObj.isWithin = isWithin + -- eventObj.isWithin = isWithin if cloneEv and cloneEv.isWithin and ( self.consumeAll or cloneEv.handled ) then eventObj.handled = true end - return r == nil and true or r + -- return r end --[[