Changed hasScrollHandler to be a function to better work with dynamically added handlers

Previously, we were setting hasScrollHandler once in the constructor and never re-assigning it after the initial creation. Changing hasScrollHandler to a function better accommodates dynamically added/removed handlers. See previous commit for change to hasGestureHandlers for further details and reasoning.
This commit is contained in:
Jessica R. 2025-01-01 22:45:12 -07:00 committed by GitHub
parent 865c3884b2
commit 9527f15f52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -277,8 +277,6 @@
sentDragEvent: false
};
this.hasScrollHandler = !!this.scrollHandler;
if ( $.MouseTracker.havePointerEvents ) {
$.setElementPointerEvents( this.element, 'auto' );
}
@ -403,6 +401,15 @@
this.pinchHandler);
},
/**
* Do we currently have a scroll handler.
* @function
* @returns {Boolean} Do we currently have a scroll handler.
*/
hasScrollHandler: function () {
return !!this.scrollHandler;
},
/**
* Implement or assign implementation to these handlers during or after
* calling the constructor.
@ -2881,7 +2888,7 @@
eventInfo.isStoppable = true;
eventInfo.isCancelable = true;
eventInfo.preventDefault = false; // handleWheelEvent() may set true
eventInfo.preventGesture = !tracker.hasScrollHandler;
eventInfo.preventGesture = !tracker.hasScrollHandler();
eventInfo.stopPropagation = false;
break;
case 'gotpointercapture':