Skip to content

Commit

Permalink
fix: panning locked images+videos on firefox (#1217)
Browse files Browse the repository at this point in the history
* chore: Update web-ext to latest version

Fixes mozilla/web-ext#1509

* fix: panning locked images+videos on firefox

Pass the event object to the function as it's used there.

Fix #1036
  • Loading branch information
LoveIsGrief authored Aug 20, 2023
1 parent 95ca049 commit f097bde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions js/hoverzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ var hoverZoom = {
}
}

function panLockedViewer() {
function panLockedViewer(event) {
var width = imgFullSize[0].width || imgFullSize[0].videoWidth * zoomFactor;
var height = imgFullSize[0].height || imgFullSize[0].videoHeight * zoomFactor;
var widthOffset = (width - window.innerWidth) / 2;
Expand Down Expand Up @@ -953,7 +953,7 @@ var hoverZoom = {
if (viewerLocked) {
// Don't hide cursor on locked viewer & allow clicking.
if (hz.hzViewer) { hz.hzViewer.css('cursor', 'pointer'); hz.hzViewer.css('pointer-events', 'auto'); }
if (imgFullSize) panLockedViewer();
if (imgFullSize) panLockedViewer(event);
return;
}

Expand Down Expand Up @@ -2178,7 +2178,7 @@ var hoverZoom = {
zoomFactor = zoomFactor + (event.deltaY < 0 ? 1 : -1) * step;
zoomFactor = Math.max(Math.min(zoomFactor, 10), stepInit);
posViewer();
panLockedViewer();
panLockedViewer(event);
} else if (imgFullSize) {
var link = hz.currentLink, data = link.data();
if (data.hoverZoomGallerySrc && data.hoverZoomGallerySrc.length !== 1) {
Expand Down Expand Up @@ -2294,7 +2294,7 @@ var hoverZoom = {
zoomFactor = parseInt(options.zoomFactor);
}
posViewer();
panLockedViewer();
panLockedViewer(event);
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"eslint": "^7.18.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"web-ext": "^5.5.0"
"web-ext": "^7.6.2"
}
}

0 comments on commit f097bde

Please sign in to comment.