Skip to content

Commit 9cdf587

Browse files
Fix #848.
1 parent e400a24 commit 9cdf587

File tree

12 files changed

+47
-20
lines changed

12 files changed

+47
-20
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 : 4.0.13
3+
* Version : 4.0.14
44
* License : MIT
55
* Copyright: 2022 Naotoshi Fujita
66
*/
@@ -1646,7 +1646,7 @@ function Controller(Splide2, Components2, options) {
16461646
}
16471647

16481648
function computeDestIndex(dest, from, snapPage) {
1649-
if (isEnough()) {
1649+
if (isEnough() || hasFocus()) {
16501650
var end = getEnd();
16511651
var index = computeMovableDestIndex(dest);
16521652

dist/js/splide.esm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
44

55
/*!
66
* Splide.js
7-
* Version : 4.0.13
7+
* Version : 4.0.14
88
* License : MIT
99
* Copyright: 2022 Naotoshi Fujita
1010
*/
@@ -1641,7 +1641,7 @@ function Controller(Splide2, Components2, options) {
16411641
}
16421642

16431643
function computeDestIndex(dest, from, snapPage) {
1644-
if (isEnough()) {
1644+
if (isEnough() || hasFocus()) {
16451645
var end = getEnd();
16461646
var index = computeMovableDestIndex(dest);
16471647

dist/js/splide.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
44

55
/*!
66
* Splide.js
7-
* Version : 4.0.13
7+
* Version : 4.0.14
88
* License : MIT
99
* Copyright: 2022 Naotoshi Fujita
1010
*/
@@ -1639,7 +1639,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
16391639
}
16401640

16411641
function computeDestIndex(dest, from, snapPage) {
1642-
if (isEnough()) {
1642+
if (isEnough() || hasFocus()) {
16431643
var end = getEnd();
16441644
var index = computeMovableDestIndex(dest);
16451645

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

2 Bytes
Binary file not shown.

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

package-lock.json

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

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": "4.0.13",
3+
"version": "4.0.14",
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,17 @@ export function Controller( Splide: Splide, Components: Components, options: Opt
193193
* - If the `move` option is `true`, finds the dest index whose position is different with the current one.
194194
* - This may return clone indices if the editor is the loop mode,
195195
* or `-1` if there is no slide to go.
196-
* - There are still slides where the slider can go if borders are between `from` and `dest`.
196+
* - There are still slides where the carousel can go if borders are between `from` and `dest`.
197+
* - If `focus` is available, needs to calculate the dest index even if there are enough number of slides.
197198
*
198-
* @param dest - The desired destination.
199+
* @param dest - The desired destination index.
199200
* @param from - A base index.
200201
* @param snapPage - Optional. Whether to snap a page or not.
201202
*
202203
* @return A converted destination index, including clones.
203204
*/
204205
function computeDestIndex( dest: number, from: number, snapPage?: boolean ): number {
205-
if ( isEnough() ) {
206+
if ( isEnough() || hasFocus() ) {
206207
const end = getEnd();
207208
const index = computeMovableDestIndex( dest );
208209

@@ -239,7 +240,7 @@ export function Controller( Splide: Splide, Components: Components, options: Opt
239240
}
240241

241242
/**
242-
* Finds the dest index whose position is different with the current one.
243+
* Finds the dest index whose position is different with the current one for `trimSpace: 'move'`.
243244
* This can be negative or greater than `length - 1`.
244245
*
245246
* @param dest - A dest index.

0 commit comments

Comments
 (0)