Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing right click bug and removing minified dist files for now. #2

Merged
merged 1 commit into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions dist/photoswipe-ui-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,20 +729,25 @@ var PhotoSwipeUI_Default =

if(e.detail && e.detail.pointerType === 'mouse') {

// close gallery if clicked outside of the image
if(_hasCloseClass(target)) {
pswp.close();
return;
}
// Silently ignore right-click events.
if (!e.detail.rightClick) {

// close gallery if clicked outside of the image
if(_hasCloseClass(target)) {
pswp.close();
return;
}

if(framework.hasClass(target, 'pswp__img')) {
if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
if(_options.clickToCloseNonZoomable) {
pswp.close();
if(framework.hasClass(target, 'pswp__img')) {
if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
if(_options.clickToCloseNonZoomable) {
pswp.close();
}
} else {
pswp.toggleDesktopZoom(e.detail.releasePoint);
}
} else {
pswp.toggleDesktopZoom(e.detail.releasePoint);
}

}

} else {
Expand Down
4 changes: 0 additions & 4 deletions dist/photoswipe-ui-default.min.js

This file was deleted.

5 changes: 3 additions & 2 deletions dist/photoswipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -3201,9 +3201,10 @@ var tapTimer,
var e = document.createEvent( 'CustomEvent' ),
eDetail = {
origEvent:origEvent,
target:origEvent.target,
pointerType:pointerType || 'touch',
releasePoint: releasePoint,
pointerType:pointerType || 'touch'
target:origEvent.target,
rightClick: pointerType === 'mouse' && origEvent.which === 3
};

e.initCustomEvent( 'pswpTap', true, true, eDetail );
Expand Down
4 changes: 0 additions & 4 deletions dist/photoswipe.min.js

This file was deleted.

9 changes: 5 additions & 4 deletions src/js/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ var tapTimer,
_dispatchTapEvent = function(origEvent, releasePoint, pointerType) {
var e = document.createEvent( 'CustomEvent' ),
eDetail = {
origEvent:origEvent,
target:origEvent.target,
releasePoint: releasePoint,
pointerType:pointerType || 'touch'
origEvent: origEvent,
pointerType: pointerType || 'touch',
releasePoint: releasePoint,
target: origEvent.target,
rightClick: pointerType === 'mouse' && origEvent.which === 3
};

e.initCustomEvent( 'pswpTap', true, true, eDetail );
Expand Down
27 changes: 16 additions & 11 deletions src/js/ui/photoswipe-ui-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,20 +726,25 @@ var PhotoSwipeUI_Default =

if(e.detail && e.detail.pointerType === 'mouse') {

// close gallery if clicked outside of the image
if(_hasCloseClass(target)) {
pswp.close();
return;
}
// Silently ignore right-click events.
if (!e.detail.rightClick) {

// close gallery if clicked outside of the image
if(_hasCloseClass(target)) {
pswp.close();
return;
}

if(framework.hasClass(target, 'pswp__img')) {
if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
if(_options.clickToCloseNonZoomable) {
pswp.close();
if(framework.hasClass(target, 'pswp__img')) {
if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {
if(_options.clickToCloseNonZoomable) {
pswp.close();
}
} else {
pswp.toggleDesktopZoom(e.detail.releasePoint);
}
} else {
pswp.toggleDesktopZoom(e.detail.releasePoint);
}

}

} else {
Expand Down