Skip to content

Commit 120776f

Browse files
Bug Fix: getAdjacent() returns an incorrect index when the perMove option is 2.
1 parent a1e0776 commit 120776f

File tree

13 files changed

+75
-50
lines changed

13 files changed

+75
-50
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Splide.js
3-
* Version : 3.1.2
3+
* Version : 3.1.3
44
* License : MIT
55
* Copyright: 2021 Naotoshi Fujita
66
*/
@@ -1354,7 +1354,7 @@ function Controller(Splide2, Components2, options) {
13541354
return getAdjacent(true, destination);
13551355
}
13561356
function getAdjacent(prev, destination) {
1357-
const number = perMove || hasFocus() ? 1 : perPage;
1357+
const number = perMove || (hasFocus() ? 1 : perPage);
13581358
const dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex);
13591359
if (dest === -1 && isSlide) {
13601360
if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) {

dist/js/splide.esm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Splide.js
3-
* Version : 3.1.2
3+
* Version : 3.1.3
44
* License : MIT
55
* Copyright: 2021 Naotoshi Fujita
66
*/
@@ -1350,7 +1350,7 @@ function Controller(Splide2, Components2, options) {
13501350
return getAdjacent(true, destination);
13511351
}
13521352
function getAdjacent(prev, destination) {
1353-
const number = perMove || hasFocus() ? 1 : perPage;
1353+
const number = perMove || (hasFocus() ? 1 : perPage);
13541354
const dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex);
13551355
if (dest === -1 && isSlide) {
13561356
if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) {

dist/js/splide.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.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

0 Bytes
Binary file not shown.

dist/types/types/options.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export interface ResponsiveOptions {
285285
*/
286286
flickPower?: number;
287287
/**
288-
* Limies the number of pages to move by "flick".
288+
* Limits the number of pages to move by "flick".
289289
*/
290290
flickMaxPages?: number;
291291
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splidejs/splide",
3-
"version": "3.1.2",
3+
"version": "3.1.3",
44
"description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
55
"author": "Naotoshi Fujita",
66
"license": "MIT",

src/js/components/Controller/Controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export function Controller( Splide: Splide, Components: Components, options: Opt
197197
* @return An adjacent index if available, or otherwise `-1`.
198198
*/
199199
function getAdjacent( prev: boolean, destination?: boolean ): number {
200-
const number = perMove || hasFocus() ? 1 : perPage;
200+
const number = perMove || ( hasFocus() ? 1 : perPage );
201201
const dest = computeDestIndex( currIndex + number * ( prev ? -1 : 1 ), currIndex );
202202

203203
if ( dest === -1 && isSlide ) {

0 commit comments

Comments
 (0)