@egjs/flicking 4.11.1 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declaration/control/Control.d.ts +1 -0
- package/dist/flicking.cjs.js +9 -6
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +9 -6
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +9 -6
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +9 -6
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/control/Control.ts +4 -0
- package/src/control/StrictControl.ts +4 -4
package/package.json
CHANGED
package/src/control/Control.ts
CHANGED
|
@@ -23,6 +23,7 @@ abstract class Control {
|
|
|
23
23
|
protected _flicking: Flicking | null;
|
|
24
24
|
protected _controller: AxesController;
|
|
25
25
|
protected _activePanel: Panel | null;
|
|
26
|
+
protected _nextPanel: Panel | null;
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* A controller that handles the {@link https://naver.github.io/egjs-axes/ @egjs/axes} events
|
|
@@ -317,6 +318,7 @@ abstract class Control {
|
|
|
317
318
|
const flicking = getFlickingAttached(this._flicking);
|
|
318
319
|
|
|
319
320
|
this._activePanel = newActivePanel;
|
|
321
|
+
this._nextPanel = null;
|
|
320
322
|
|
|
321
323
|
flicking.camera.updateAdaptiveHeight();
|
|
322
324
|
|
|
@@ -357,6 +359,8 @@ abstract class Control {
|
|
|
357
359
|
isTrusted: axesEvent?.isTrusted || false,
|
|
358
360
|
direction: getDirection(activePanel?.position ?? camera.position, position)
|
|
359
361
|
});
|
|
362
|
+
|
|
363
|
+
this._nextPanel = panel;
|
|
360
364
|
flicking.trigger(event);
|
|
361
365
|
|
|
362
366
|
if (event.isCanceled()) {
|
|
@@ -190,7 +190,7 @@ class StrictControl extends Control {
|
|
|
190
190
|
public moveToPosition(position: number, duration: number, axesEvent?: OnRelease) {
|
|
191
191
|
const flicking = getFlickingAttached(this._flicking);
|
|
192
192
|
const camera = flicking.camera;
|
|
193
|
-
const
|
|
193
|
+
const currentPanel = this._nextPanel ?? this._activePanel;
|
|
194
194
|
const axesRange = this._controller.range;
|
|
195
195
|
const indexRange = this._indexRange;
|
|
196
196
|
const cameraRange = camera.range;
|
|
@@ -199,11 +199,11 @@ class StrictControl extends Control {
|
|
|
199
199
|
const clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
200
200
|
const anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
201
201
|
|
|
202
|
-
if (!anchorAtPosition || !
|
|
202
|
+
if (!anchorAtPosition || !currentPanel) {
|
|
203
203
|
return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(position), ERROR.CODE.POSITION_NOT_REACHABLE));
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
const prevPos =
|
|
206
|
+
const prevPos = currentPanel.position;
|
|
207
207
|
const posDelta = flicking.animating
|
|
208
208
|
? state.delta
|
|
209
209
|
: position - camera.position;
|
|
@@ -233,7 +233,7 @@ class StrictControl extends Control {
|
|
|
233
233
|
|
|
234
234
|
targetPanel = targetAnchor.panel;
|
|
235
235
|
targetPos = targetAnchor.position;
|
|
236
|
-
} else if (isOverThreshold && anchorAtPosition.position !==
|
|
236
|
+
} else if (isOverThreshold && anchorAtPosition.position !== currentPanel.position) {
|
|
237
237
|
// Move to anchor at position
|
|
238
238
|
targetPanel = anchorAtPosition.panel;
|
|
239
239
|
targetPos = anchorAtPosition.position;
|