Skip to content

Commit

Permalink
Release 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygd committed Sep 7, 2021
1 parent 57ff019 commit 966254b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
24 changes: 11 additions & 13 deletions dist/BigPicture.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ var BigPicture = (function () {

// create all needed methods / store dom elements on first use
function initialize() {
var startX;
var startX, isPinch;
// return close button elements
function createCloseButton(className) {
var el = document[createEl]('button');
Expand Down Expand Up @@ -224,28 +224,26 @@ var BigPicture = (function () {
container.onclick = close;
closeButton = createCloseButton('bp-x');
container[appendEl](closeButton);
// gallery swipe listeners
if ('ontouchstart' in window) {
// gallery touch listeners
if ('ontouchend' in window && window.visualViewport) {
supportsTouch = true;
container.ontouchstart = function (ref) {
var touches = ref.touches;
var changedTouches = ref.changedTouches;

isPinch = touches.length > 1;
startX = changedTouches[0].pageX;
};
container.ontouchmove = function (e) {
e.preventDefault();
};
container.ontouchend = function (ref) {
var changedTouches = ref.changedTouches;

if (!galleryOpen) {
return
if (galleryOpen && !isPinch && window.visualViewport.scale <= 1) {
var distX = changedTouches[0].pageX - startX;
// swipe right
distX < -30 && updateGallery(1);
// swipe left
distX > 30 && updateGallery(-1);
}
var distX = changedTouches[0].pageX - startX;
// swipe right
distX < -30 && updateGallery(1);
// swipe left
distX > 30 && updateGallery(-1);
};
}

Expand Down
2 changes: 1 addition & 1 deletion dist/BigPicture.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 966254b

Please sign in to comment.