From 533a8ba5326e8661bc780c1bdbd912f10daee034 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 20 Sep 2021 11:41:23 -0700 Subject: [PATCH 1/7] Attempting to get the original target for click events --- src/mousetracker.js | 3 +++ src/viewer.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/mousetracker.js b/src/mousetracker.js index 75ec7be0..389b6a4b 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -3272,6 +3272,7 @@ //updateGPoint.captured = true; // Handled by updatePointerCaptured() updateGPoint.insideElementPressed = true; updateGPoint.insideElement = true; + updateGPoint.originalTarget = eventInfo.originalEvent.target; updateGPoint.contactPos = gPoint.currentPos; updateGPoint.contactTime = gPoint.currentTime; updateGPoint.lastPos = updateGPoint.currentPos; @@ -3286,6 +3287,7 @@ gPoint.captured = false; // Handled by updatePointerCaptured() gPoint.insideElementPressed = true; gPoint.insideElement = true; + gPoint.originalTarget = eventInfo.originalEvent.target; startTrackingPointer( pointsList, gPoint ); return; } @@ -3504,6 +3506,7 @@ shift: eventInfo.originalEvent.shiftKey, isTouchEvent: updateGPoint.type === 'touch', originalEvent: eventInfo.originalEvent, + originalTarget: updateGPoint.originalTarget, userData: tracker.userData } ); diff --git a/src/viewer.js b/src/viewer.js index d8e75857..1b12da37 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2850,6 +2850,7 @@ function onCanvasClick( event ) { quick: event.quick, shift: event.shift, originalEvent: event.originalEvent, + originalTarget: event.originalTarget, preventDefaultAction: false }; From 6761bd9375f7ab4636413f70057f748fb8fb3f7e Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 22 Sep 2021 11:37:55 -0700 Subject: [PATCH 2/7] Added documentation for originalTarget --- src/mousetracker.js | 2 ++ src/viewer.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/mousetracker.js b/src/mousetracker.js index 389b6a4b..f51c0d83 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -737,6 +737,8 @@ * True if the original event is a touch event, otherwise false. Deprecated. Use pointerType and/or originalEvent instead. * @param {Object} event.originalEvent * The original event object. + * @param {Element} event.originalTarget + * The DOM element clicked on. * @param {Object} event.userData * Arbitrary user-defined object. */ diff --git a/src/viewer.js b/src/viewer.js index 1b12da37..652efe75 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2866,6 +2866,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} shift - True if the shift key was pressed during this 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 {?Object} userData - Arbitrary subscriber-defined object. */ From ecfe380b17b5f921a4cb0e4f2bd9c733479015ab Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 22 Sep 2021 11:41:17 -0700 Subject: [PATCH 3/7] Fixed spelling of isStoppable --- src/mousetracker.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index f51c0d83..aeb1c498 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1193,7 +1193,7 @@ * 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 * 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. * @property {Boolean} isCancelable * True if the event's default handling by the browser can be prevented with preventDefault. @@ -2840,7 +2840,7 @@ function getEventProcessDefaults( tracker, eventInfo ) { switch ( eventInfo.eventType ) { case 'pointermove': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = false; eventInfo.preventGesture = !tracker.hasGestureHandlers; @@ -2852,28 +2852,28 @@ case 'keydown': case 'keyup': case 'keypress': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = false; // onContextMenu(), onKeyDown(), onKeyUp(), onKeyPress() may set true eventInfo.preventGesture = false; eventInfo.stopPropagation = false; break; case 'pointerdown': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = false; // updatePointerDown() may set true (tracker.hasGestureHandlers) eventInfo.preventGesture = !tracker.hasGestureHandlers; eventInfo.stopPropagation = false; break; case 'pointerup': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = false; eventInfo.preventGesture = !tracker.hasGestureHandlers; eventInfo.stopPropagation = false; break; case 'wheel': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = false; // handleWheelEvent() may set true eventInfo.preventGesture = !tracker.hasScrollHandler; @@ -2882,21 +2882,21 @@ case 'gotpointercapture': case 'lostpointercapture': case 'pointercancel': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = false; eventInfo.preventDefault = false; eventInfo.preventGesture = false; eventInfo.stopPropagation = false; break; case 'click': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = !!tracker.clickHandler; eventInfo.preventGesture = false; eventInfo.stopPropagation = false; break; case 'dblclick': - eventInfo.isStopable = true; + eventInfo.isStoppable = true; eventInfo.isCancelable = true; eventInfo.preventDefault = !!tracker.dblClickHandler; eventInfo.preventGesture = false; @@ -2907,7 +2907,7 @@ case 'pointerenter': case 'pointerleave': default: - eventInfo.isStopable = false; + eventInfo.isStoppable = false; eventInfo.isCancelable = false; eventInfo.preventDefault = false; eventInfo.preventGesture = false; From ca736de339122b4f150f44cf0601d49e43e04c6e Mon Sep 17 00:00:00 2001 From: Mark Salsbery <> Date: Thu, 23 Sep 2021 14:16:39 -0700 Subject: [PATCH 4/7] Removed unnecessary pointer-events:none setting on overlay container DIV --- src/viewer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index d8e75857..ecec2420 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -408,7 +408,6 @@ $.Viewer = function( options ) { // Overlay container this.overlaysContainer = $.makeNeutralElement( "div" ); - $.setElementPointerEventsNone( this.overlaysContainer ); $.setElementTouchActionNone( this.overlaysContainer ); this.canvas.appendChild( this.overlaysContainer ); From 8c16ba50b58b3e7fdac03a7a7559a03b2c269f7c Mon Sep 17 00:00:00 2001 From: Mark Salsbery <> Date: Thu, 23 Sep 2021 14:19:29 -0700 Subject: [PATCH 5/7] changelog update --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 58cf8804..2f447f4a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -54,7 +54,8 @@ OPENSEADRAGON CHANGELOG * Added a static method in OpenSeadragon to get an existing viewer (#2000 @HerCerM) * 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) -* 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) +* Removed unnecessary pointer-events:none setting on overlay container DIV element (#2042 @msalsbery) 2.4.2: From 803ade38d89529573f1161136bc6257a0179a8ee Mon Sep 17 00:00:00 2001 From: Mark Salsbery <> Date: Thu, 23 Sep 2021 14:35:09 -0700 Subject: [PATCH 6/7] Removed touch-action:none setting --- changelog.txt | 2 +- src/viewer.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2f447f4a..f53a0063 100644 --- a/changelog.txt +++ b/changelog.txt @@ -55,7 +55,7 @@ OPENSEADRAGON CHANGELOG * 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) * Fixed a bug where the navigator wouldn't pick up opacity/composite changes made while it is loading (#2018 @crydell) -* Removed unnecessary pointer-events:none setting on overlay container DIV element (#2042 @msalsbery) +* Removed unnecessary touch-action:none and pointer-events:none settings on overlay container DIV element (#2042 @msalsbery) 2.4.2: diff --git a/src/viewer.js b/src/viewer.js index ecec2420..02d4ff97 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -408,7 +408,6 @@ $.Viewer = function( options ) { // Overlay container this.overlaysContainer = $.makeNeutralElement( "div" ); - $.setElementTouchActionNone( 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 From ea7057b601633e101b89781b08bfd9067770c88c Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 27 Sep 2021 11:34:15 -0700 Subject: [PATCH 7/7] Removed changelog for #2042 and added one for #2037 --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index f53a0063..ad1bc375 100644 --- a/changelog.txt +++ b/changelog.txt @@ -55,7 +55,7 @@ OPENSEADRAGON CHANGELOG * 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) * Fixed a bug where the navigator wouldn't pick up opacity/composite changes made while it is loading (#2018 @crydell) -* Removed unnecessary touch-action:none and pointer-events:none settings on overlay container DIV element (#2042 @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: