Skip to content

Commit

Permalink
Bug Fix: Safari on iOS 15 triggers the window resize event when swipi…
Browse files Browse the repository at this point in the history
…ng action resizes the bottom nav bar.
  • Loading branch information
NaotoshiFujita committed Oct 20, 2021
1 parent 174ad02 commit e428e13
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 62 deletions.
2 changes: 1 addition & 1 deletion dist/js/splide-renderer.min.js

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

30 changes: 18 additions & 12 deletions dist/js/splide.cjs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Splide.js
* Version : 3.1.8
* Version : 3.1.9
* License : MIT
* Copyright: 2021 Naotoshi Fujita
*/
Expand Down Expand Up @@ -1173,9 +1173,11 @@ function Move(Splide2, Components2, options) {
removeAttribute(list, "style");
}
function reposition() {
Components2.Scroll.cancel();
jump(Splide2.index);
emit(EVENT_REPOSITIONED);
if (!Components2.Drag.isDragging()) {
Components2.Scroll.cancel();
jump(Splide2.index);
emit(EVENT_REPOSITIONED);
}
}
function move(dest, index, prev, callback) {
if (!isBusy()) {
Expand Down Expand Up @@ -1741,7 +1743,7 @@ function Drag(Splide2, Components2, options) {
let prevBaseEvent;
let lastEvent;
let isFree;
let isDragging;
let dragging;
let hasExceeded = false;
let clickPrevented;
let disabled;
Expand Down Expand Up @@ -1785,7 +1787,7 @@ function Drag(Splide2, Components2, options) {
}
lastEvent = e;
if (e.cancelable) {
if (isDragging) {
if (dragging) {
const expired = timeOf(e) - timeOf(baseEvent) > LOG_INTERVAL;
const exceeded = hasExceeded !== (hasExceeded = exceededLimit());
if (expired || exceeded) {
Expand All @@ -1799,7 +1801,7 @@ function Drag(Splide2, Components2, options) {
const diff = abs(coordOf(e) - coordOf(baseEvent));
let { dragMinThreshold: thresholds } = options;
thresholds = isObject(thresholds) ? thresholds : { mouse: 0, touch: +thresholds || 10 };
isDragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
dragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
if (isSliderDirection()) {
prevent(e);
}
Expand All @@ -1810,7 +1812,7 @@ function Drag(Splide2, Components2, options) {
unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
unbind(target, POINTER_UP_EVENTS, onPointerUp);
if (lastEvent) {
if (isDragging || e.cancelable && isSliderDirection()) {
if (dragging || e.cancelable && isSliderDirection()) {
const velocity = computeVelocity(e);
const destination = computeDestination(velocity);
if (isFree) {
Expand All @@ -1824,7 +1826,7 @@ function Drag(Splide2, Components2, options) {
}
emit(EVENT_DRAGGED);
}
isDragging = false;
dragging = false;
}
function save(e) {
prevBaseEvent = baseEvent;
Expand Down Expand Up @@ -1862,18 +1864,22 @@ function Drag(Splide2, Components2, options) {
function timeOf(e) {
return e.timeStamp;
}
function constrain(diff) {
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
}
function isTouchEvent(e) {
return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
}
function constrain(diff) {
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
function isDragging() {
return dragging;
}
function disable(value) {
disabled = value;
}
return {
mount,
disable
disable,
isDragging
};
}

Expand Down
30 changes: 18 additions & 12 deletions dist/js/splide.esm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Splide.js
* Version : 3.1.8
* Version : 3.1.9
* License : MIT
* Copyright: 2021 Naotoshi Fujita
*/
Expand Down Expand Up @@ -1169,9 +1169,11 @@ function Move(Splide2, Components2, options) {
removeAttribute(list, "style");
}
function reposition() {
Components2.Scroll.cancel();
jump(Splide2.index);
emit(EVENT_REPOSITIONED);
if (!Components2.Drag.isDragging()) {
Components2.Scroll.cancel();
jump(Splide2.index);
emit(EVENT_REPOSITIONED);
}
}
function move(dest, index, prev, callback) {
if (!isBusy()) {
Expand Down Expand Up @@ -1737,7 +1739,7 @@ function Drag(Splide2, Components2, options) {
let prevBaseEvent;
let lastEvent;
let isFree;
let isDragging;
let dragging;
let hasExceeded = false;
let clickPrevented;
let disabled;
Expand Down Expand Up @@ -1781,7 +1783,7 @@ function Drag(Splide2, Components2, options) {
}
lastEvent = e;
if (e.cancelable) {
if (isDragging) {
if (dragging) {
const expired = timeOf(e) - timeOf(baseEvent) > LOG_INTERVAL;
const exceeded = hasExceeded !== (hasExceeded = exceededLimit());
if (expired || exceeded) {
Expand All @@ -1795,7 +1797,7 @@ function Drag(Splide2, Components2, options) {
const diff = abs(coordOf(e) - coordOf(baseEvent));
let { dragMinThreshold: thresholds } = options;
thresholds = isObject(thresholds) ? thresholds : { mouse: 0, touch: +thresholds || 10 };
isDragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
dragging = diff > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse);
if (isSliderDirection()) {
prevent(e);
}
Expand All @@ -1806,7 +1808,7 @@ function Drag(Splide2, Components2, options) {
unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
unbind(target, POINTER_UP_EVENTS, onPointerUp);
if (lastEvent) {
if (isDragging || e.cancelable && isSliderDirection()) {
if (dragging || e.cancelable && isSliderDirection()) {
const velocity = computeVelocity(e);
const destination = computeDestination(velocity);
if (isFree) {
Expand All @@ -1820,7 +1822,7 @@ function Drag(Splide2, Components2, options) {
}
emit(EVENT_DRAGGED);
}
isDragging = false;
dragging = false;
}
function save(e) {
prevBaseEvent = baseEvent;
Expand Down Expand Up @@ -1858,18 +1860,22 @@ function Drag(Splide2, Components2, options) {
function timeOf(e) {
return e.timeStamp;
}
function constrain(diff) {
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
}
function isTouchEvent(e) {
return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
}
function constrain(diff) {
return diff / (hasExceeded && Splide2.is(SLIDE) ? FRICTION : 1);
function isDragging() {
return dragging;
}
function disable(value) {
disabled = value;
}
return {
mount,
disable
disable,
isDragging
};
}

Expand Down
31 changes: 19 additions & 12 deletions dist/js/splide.js

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

2 changes: 1 addition & 1 deletion dist/js/splide.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/splide.min.js

Large diffs are not rendered by default.

Binary file modified dist/js/splide.min.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/types/components/Drag/Drag.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BaseComponent, Components, Options } from '../../types';
*/
export interface DragComponent extends BaseComponent {
disable(disabled: boolean): void;
isDragging(): boolean;
}
/**
* The component for dragging the slider.
Expand Down
2 changes: 1 addition & 1 deletion dist/types/components/Drag/Drag.d.ts.map

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

2 changes: 1 addition & 1 deletion dist/types/components/Move/Move.d.ts.map

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

2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splidejs/splide",
"version": "3.1.8",
"version": "3.1.9",
"description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
"author": "Naotoshi Fujita",
"license": "MIT",
Expand Down
Loading

0 comments on commit e428e13

Please sign in to comment.