Merge branch 'master' into ms-passivewheel

This commit is contained in:
Ian Gilman 2021-09-27 11:38:31 -07:00
commit 267c8c65cd
3 changed files with 19 additions and 13 deletions

View File

@ -55,7 +55,8 @@ OPENSEADRAGON CHANGELOG
* Now ensuring that the new item is already in the navigator when the "add-item" event fires (#2005 @RammasEchor) * Now ensuring that the new item is already in the navigator when the "add-item" event fires (#2005 @RammasEchor)
* Added keys to change image in sequence mode (j: previous, k: next) (#2007 @RammasEchor) * Added keys to change image in sequence mode (j: previous, k: next) (#2007 @RammasEchor)
* Fixed a bug where the navigator wouldn't pick up opacity/composite changes made while it is loading (#2018 @crydell) * Fixed a bug where the navigator wouldn't pick up opacity/composite changes made while it is loading (#2018 @crydell)
* Explicitly set passive:false for wheel event handlers to supress console warnings. Fixes #1669 (#2043 @msalsbery) * Explicitly set passive:false for wheel event handlers to suppress console warnings. Fixes #1669 (#2043 @msalsbery)
* Viewer's canvas-click events now include an originalTarget property so you can know which element received the click (#2037 @iangilman)
2.4.2: 2.4.2:

View File

@ -737,6 +737,8 @@
* True if the original event is a touch event, otherwise false. <span style="color:red;">Deprecated. Use pointerType and/or originalEvent instead.</span> * True if the original event is a touch event, otherwise false. <span style="color:red;">Deprecated. Use pointerType and/or originalEvent instead.</span>
* @param {Object} event.originalEvent * @param {Object} event.originalEvent
* The original event object. * The original event object.
* @param {Element} event.originalTarget
* The DOM element clicked on.
* @param {Object} event.userData * @param {Object} event.userData
* Arbitrary user-defined object. * Arbitrary user-defined object.
*/ */
@ -1191,7 +1193,7 @@
* the emulated event, a synthetic event object created with values from the actual DOM event, * the emulated event, a synthetic event object created with values from the actual DOM event,
* or null if no DOM event applies. Emulated events can occur on eventType "wheel" on legacy mouse-scroll * or null if no DOM event applies. Emulated events can occur on eventType "wheel" on legacy mouse-scroll
* event emitting user agents. * event emitting user agents.
* @property {Boolean} isStopable * @property {Boolean} isStoppable
* True if propagation of the event (e.g. bubbling) can be stopped with stopPropagation/stopImmediatePropagation. * True if propagation of the event (e.g. bubbling) can be stopped with stopPropagation/stopImmediatePropagation.
* @property {Boolean} isCancelable * @property {Boolean} isCancelable
* True if the event's default handling by the browser can be prevented with preventDefault. * True if the event's default handling by the browser can be prevented with preventDefault.
@ -2838,7 +2840,7 @@
function getEventProcessDefaults( tracker, eventInfo ) { function getEventProcessDefaults( tracker, eventInfo ) {
switch ( eventInfo.eventType ) { switch ( eventInfo.eventType ) {
case 'pointermove': case 'pointermove':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = false; eventInfo.preventDefault = false;
eventInfo.preventGesture = !tracker.hasGestureHandlers; eventInfo.preventGesture = !tracker.hasGestureHandlers;
@ -2850,28 +2852,28 @@
case 'keydown': case 'keydown':
case 'keyup': case 'keyup':
case 'keypress': case 'keypress':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = false; // onContextMenu(), onKeyDown(), onKeyUp(), onKeyPress() may set true eventInfo.preventDefault = false; // onContextMenu(), onKeyDown(), onKeyUp(), onKeyPress() may set true
eventInfo.preventGesture = false; eventInfo.preventGesture = false;
eventInfo.stopPropagation = false; eventInfo.stopPropagation = false;
break; break;
case 'pointerdown': case 'pointerdown':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = false; // updatePointerDown() may set true (tracker.hasGestureHandlers) eventInfo.preventDefault = false; // updatePointerDown() may set true (tracker.hasGestureHandlers)
eventInfo.preventGesture = !tracker.hasGestureHandlers; eventInfo.preventGesture = !tracker.hasGestureHandlers;
eventInfo.stopPropagation = false; eventInfo.stopPropagation = false;
break; break;
case 'pointerup': case 'pointerup':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = false; eventInfo.preventDefault = false;
eventInfo.preventGesture = !tracker.hasGestureHandlers; eventInfo.preventGesture = !tracker.hasGestureHandlers;
eventInfo.stopPropagation = false; eventInfo.stopPropagation = false;
break; break;
case 'wheel': case 'wheel':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = false; // handleWheelEvent() may set true eventInfo.preventDefault = false; // handleWheelEvent() may set true
eventInfo.preventGesture = !tracker.hasScrollHandler; eventInfo.preventGesture = !tracker.hasScrollHandler;
@ -2880,21 +2882,21 @@
case 'gotpointercapture': case 'gotpointercapture':
case 'lostpointercapture': case 'lostpointercapture':
case 'pointercancel': case 'pointercancel':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = false; eventInfo.isCancelable = false;
eventInfo.preventDefault = false; eventInfo.preventDefault = false;
eventInfo.preventGesture = false; eventInfo.preventGesture = false;
eventInfo.stopPropagation = false; eventInfo.stopPropagation = false;
break; break;
case 'click': case 'click':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = !!tracker.clickHandler; eventInfo.preventDefault = !!tracker.clickHandler;
eventInfo.preventGesture = false; eventInfo.preventGesture = false;
eventInfo.stopPropagation = false; eventInfo.stopPropagation = false;
break; break;
case 'dblclick': case 'dblclick':
eventInfo.isStopable = true; eventInfo.isStoppable = true;
eventInfo.isCancelable = true; eventInfo.isCancelable = true;
eventInfo.preventDefault = !!tracker.dblClickHandler; eventInfo.preventDefault = !!tracker.dblClickHandler;
eventInfo.preventGesture = false; eventInfo.preventGesture = false;
@ -2905,7 +2907,7 @@
case 'pointerenter': case 'pointerenter':
case 'pointerleave': case 'pointerleave':
default: default:
eventInfo.isStopable = false; eventInfo.isStoppable = false;
eventInfo.isCancelable = false; eventInfo.isCancelable = false;
eventInfo.preventDefault = false; eventInfo.preventDefault = false;
eventInfo.preventGesture = false; eventInfo.preventGesture = false;
@ -3272,6 +3274,7 @@
//updateGPoint.captured = true; // Handled by updatePointerCaptured() //updateGPoint.captured = true; // Handled by updatePointerCaptured()
updateGPoint.insideElementPressed = true; updateGPoint.insideElementPressed = true;
updateGPoint.insideElement = true; updateGPoint.insideElement = true;
updateGPoint.originalTarget = eventInfo.originalEvent.target;
updateGPoint.contactPos = gPoint.currentPos; updateGPoint.contactPos = gPoint.currentPos;
updateGPoint.contactTime = gPoint.currentTime; updateGPoint.contactTime = gPoint.currentTime;
updateGPoint.lastPos = updateGPoint.currentPos; updateGPoint.lastPos = updateGPoint.currentPos;
@ -3286,6 +3289,7 @@
gPoint.captured = false; // Handled by updatePointerCaptured() gPoint.captured = false; // Handled by updatePointerCaptured()
gPoint.insideElementPressed = true; gPoint.insideElementPressed = true;
gPoint.insideElement = true; gPoint.insideElement = true;
gPoint.originalTarget = eventInfo.originalEvent.target;
startTrackingPointer( pointsList, gPoint ); startTrackingPointer( pointsList, gPoint );
return; return;
} }
@ -3504,6 +3508,7 @@
shift: eventInfo.originalEvent.shiftKey, shift: eventInfo.originalEvent.shiftKey,
isTouchEvent: updateGPoint.type === 'touch', isTouchEvent: updateGPoint.type === 'touch',
originalEvent: eventInfo.originalEvent, originalEvent: eventInfo.originalEvent,
originalTarget: updateGPoint.originalTarget,
userData: tracker.userData userData: tracker.userData
} }
); );

View File

@ -408,8 +408,6 @@ $.Viewer = function( options ) {
// Overlay container // Overlay container
this.overlaysContainer = $.makeNeutralElement( "div" ); this.overlaysContainer = $.makeNeutralElement( "div" );
$.setElementPointerEventsNone( this.overlaysContainer );
$.setElementTouchActionNone( this.overlaysContainer );
this.canvas.appendChild( this.overlaysContainer ); this.canvas.appendChild( this.overlaysContainer );
// Now that we have a drawer, see if it supports rotate. If not we need to remove the rotate buttons // Now that we have a drawer, see if it supports rotate. If not we need to remove the rotate buttons
@ -2850,6 +2848,7 @@ function onCanvasClick( event ) {
quick: event.quick, quick: event.quick,
shift: event.shift, shift: event.shift,
originalEvent: event.originalEvent, originalEvent: event.originalEvent,
originalTarget: event.originalTarget,
preventDefaultAction: false preventDefaultAction: false
}; };
@ -2865,6 +2864,7 @@ function onCanvasClick( event ) {
* @property {Boolean} quick - True only if the clickDistThreshold and clickTimeThreshold are both passed. Useful for differentiating between clicks and drags. * @property {Boolean} quick - True only if the clickDistThreshold and clickTimeThreshold are both passed. Useful for differentiating between clicks and drags.
* @property {Boolean} shift - True if the shift key was pressed during this event. * @property {Boolean} shift - True if the shift key was pressed during this event.
* @property {Object} originalEvent - The original DOM event. * @property {Object} originalEvent - The original DOM event.
* @property {Element} originalTarget - The DOM element clicked on.
* @property {Boolean} preventDefaultAction - Set to true to prevent default click to zoom behaviour. Default: false. * @property {Boolean} preventDefaultAction - Set to true to prevent default click to zoom behaviour. Default: false.
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */