Skip to content

Commit 8cb6bb0

Browse files
committed
Update live-view.js
1 parent 2f3f5d4 commit 8cb6bb0

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

live-view/live-view.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ function addBottomSwipeListener() {
451451

452452
yOffset = 0;
453453
active = false;
454+
swiped = false;
454455

455456
}
456457

@@ -476,7 +477,8 @@ function addBottomSwipeListener() {
476477
}
477478

478479
// check if passed swipe boundary
479-
if (Math.abs(yOffset) > yBoundary) {
480+
if (Math.abs(yOffset) > yBoundary
481+
|| swiped) {
480482
swiped = true;
481483
} else {
482484
swiped = false;
@@ -503,12 +505,8 @@ function addBottomSwipeListener() {
503505

504506
}
505507

506-
toggleLiveView(selectedFile);
507-
508-
// wait until animation has ended to enable swiping
509-
window.setTimeout(() => {
510-
swiped = false;
511-
}, 400);
508+
// if live view is open
509+
if (liveViewToggle) toggleLiveView(selectedFile);
512510

513511
}
514512

@@ -544,13 +542,9 @@ function addBottomSwipeListener() {
544542

545543
}
546544

547-
toggleLiveView(selectedFile);
545+
// if live view is closed
546+
if (!liveViewToggle) toggleLiveView(selectedFile);
548547

549-
// wait until animation has ended to enable swiping
550-
window.setTimeout(() => {
551-
swiped = false;
552-
}, 400);
553-
554548
}
555549

556550
}

0 commit comments

Comments
 (0)