Skip to content

Commit e428e13

Browse files
Bug Fix: Safari on iOS 15 triggers the window resize event when swiping action resizes the bottom nav bar.
1 parent 174ad02 commit e428e13

File tree

14 files changed

+96
-62
lines changed

14 files changed

+96
-62
lines changed

dist/js/splide-renderer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.cjs.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Splide.js
3-
* Version : 3.1.8
3+
* Version : 3.1.9
44
* License : MIT
55
* Copyright: 2021 Naotoshi Fujita
66
*/
@@ -1173,9 +1173,11 @@ function Move(Splide2, Components2, options) {
11731173
removeAttribute(list, "style");
11741174
}
11751175
function reposition() {
1176-
Components2.Scroll.cancel();
1177-
jump(Splide2.index);
1178-
emit(EVENT_REPOSITIONED);
1176+
if (!Components2.Drag.isDragging()) {
1177+
Components2.Scroll.cancel();
1178+
jump(Splide2.index);
1179+
emit(EVENT_REPOSITIONED);
1180+
}
11791181
}
11801182
function move(dest, index, prev, callback) {
11811183
if (!isBusy()) {
@@ -1741,7 +1743,7 @@ function Drag(Splide2, Components2, options) {
17411743
let prevBaseEvent;
17421744
let lastEvent;
17431745
let isFree;
1744-
let isDragging;
1746+
let dragging;
17451747
let hasExceeded = false;
17461748
let clickPrevented;
17471749
let disabled;
@@ -1785,7 +1787,7 @@ function Drag(Splide2, Components2, options) {
17851787
}
17861788
lastEvent = e;
17871789
if (e.cancelable) {
1788-
if (isDragging) {
1790+
if (dragging) {
17891791
const expired = timeOf(e) - timeOf(baseEvent) > LOG_INTERVAL;
17901792
const exceeded = hasExceeded !== (hasExceeded = exceededLimit());
17911793
if (expired || exceeded) {
@@ -1799,7 +1801,7 @@ function Drag(Splide2, Components2, options) {
17991801
const diff = abs(coordOf(e) - coordOf(baseEvent));
18001802
let { dragMinThreshold: thresholds } = options;
18011803
thresholds = isObject(thresholds) ? thresholds : { mouse: 0, touch: +thresholds || 10 };
1802-
isDragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
1804+
dragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
18031805
if (isSliderDirection()) {
18041806
prevent(e);
18051807
}
@@ -1810,7 +1812,7 @@ function Drag(Splide2, Components2, options) {
18101812
unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
18111813
unbind(target, POINTER_UP_EVENTS, onPointerUp);
18121814
if (lastEvent) {
1813-
if (isDragging || e.cancelable && isSliderDirection()) {
1815+
if (dragging || e.cancelable && isSliderDirection()) {
18141816
const velocity = computeVelocity(e);
18151817
const destination = computeDestination(velocity);
18161818
if (isFree) {
@@ -1824,7 +1826,7 @@ function Drag(Splide2, Components2, options) {
18241826
}
18251827
emit(EVENT_DRAGGED);
18261828
}
1827-
isDragging = false;
1829+
dragging = false;
18281830
}
18291831
function save(e) {
18301832
prevBaseEvent = baseEvent;
@@ -1862,18 +1864,22 @@ function Drag(Splide2, Components2, options) {
18621864
function timeOf(e) {
18631865
return e.timeStamp;
18641866
}
1867+
function constrain(diff) {
1868+
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
1869+
}
18651870
function isTouchEvent(e) {
18661871
return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
18671872
}
1868-
function constrain(diff) {
1869-
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
1873+
function isDragging() {
1874+
return dragging;
18701875
}
18711876
function disable(value) {
18721877
disabled = value;
18731878
}
18741879
return {
18751880
mount,
1876-
disable
1881+
disable,
1882+
isDragging
18771883
};
18781884
}
18791885

dist/js/splide.esm.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Splide.js
3-
* Version : 3.1.8
3+
* Version : 3.1.9
44
* License : MIT
55
* Copyright: 2021 Naotoshi Fujita
66
*/
@@ -1169,9 +1169,11 @@ function Move(Splide2, Components2, options) {
11691169
removeAttribute(list, "style");
11701170
}
11711171
function reposition() {
1172-
Components2.Scroll.cancel();
1173-
jump(Splide2.index);
1174-
emit(EVENT_REPOSITIONED);
1172+
if (!Components2.Drag.isDragging()) {
1173+
Components2.Scroll.cancel();
1174+
jump(Splide2.index);
1175+
emit(EVENT_REPOSITIONED);
1176+
}
11751177
}
11761178
function move(dest, index, prev, callback) {
11771179
if (!isBusy()) {
@@ -1737,7 +1739,7 @@ function Drag(Splide2, Components2, options) {
17371739
let prevBaseEvent;
17381740
let lastEvent;
17391741
let isFree;
1740-
let isDragging;
1742+
let dragging;
17411743
let hasExceeded = false;
17421744
let clickPrevented;
17431745
let disabled;
@@ -1781,7 +1783,7 @@ function Drag(Splide2, Components2, options) {
17811783
}
17821784
lastEvent = e;
17831785
if (e.cancelable) {
1784-
if (isDragging) {
1786+
if (dragging) {
17851787
const expired = timeOf(e) - timeOf(baseEvent) > LOG_INTERVAL;
17861788
const exceeded = hasExceeded !== (hasExceeded = exceededLimit());
17871789
if (expired || exceeded) {
@@ -1795,7 +1797,7 @@ function Drag(Splide2, Components2, options) {
17951797
const diff = abs(coordOf(e) - coordOf(baseEvent));
17961798
let { dragMinThreshold: thresholds } = options;
17971799
thresholds = isObject(thresholds) ? thresholds : { mouse: 0, touch: +thresholds || 10 };
1798-
isDragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
1800+
dragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
17991801
if (isSliderDirection()) {
18001802
prevent(e);
18011803
}
@@ -1806,7 +1808,7 @@ function Drag(Splide2, Components2, options) {
18061808
unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
18071809
unbind(target, POINTER_UP_EVENTS, onPointerUp);
18081810
if (lastEvent) {
1809-
if (isDragging || e.cancelable && isSliderDirection()) {
1811+
if (dragging || e.cancelable && isSliderDirection()) {
18101812
const velocity = computeVelocity(e);
18111813
const destination = computeDestination(velocity);
18121814
if (isFree) {
@@ -1820,7 +1822,7 @@ function Drag(Splide2, Components2, options) {
18201822
}
18211823
emit(EVENT_DRAGGED);
18221824
}
1823-
isDragging = false;
1825+
dragging = false;
18241826
}
18251827
function save(e) {
18261828
prevBaseEvent = baseEvent;
@@ -1858,18 +1860,22 @@ function Drag(Splide2, Components2, options) {
18581860
function timeOf(e) {
18591861
return e.timeStamp;
18601862
}
1863+
function constrain(diff) {
1864+
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
1865+
}
18611866
function isTouchEvent(e) {
18621867
return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
18631868
}
1864-
function constrain(diff) {
1865-
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
1869+
function isDragging() {
1870+
return dragging;
18661871
}
18671872
function disable(value) {
18681873
disabled = value;
18691874
}
18701875
return {
18711876
mount,
1872-
disable
1877+
disable,
1878+
isDragging
18731879
};
18741880
}
18751881

dist/js/splide.js

Lines changed: 19 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.min.js.gz

20 Bytes
Binary file not shown.

dist/types/components/Drag/Drag.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { BaseComponent, Components, Options } from '../../types';
77
*/
88
export interface DragComponent extends BaseComponent {
99
disable(disabled: boolean): void;
10+
isDragging(): boolean;
1011
}
1112
/**
1213
* The component for dragging the slider.

dist/types/components/Drag/Drag.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/components/Move/Move.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)