@egjs/flicking 4.11.1 → 4.11.2-beta.0

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.
@@ -4,7 +4,7 @@ name: @egjs/flicking
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking
7
- version: 4.11.1
7
+ version: 4.11.2-beta.0
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -2606,6 +2606,7 @@ var Control = /*#__PURE__*/function () {
2606
2606
  var _a;
2607
2607
  var flicking = getFlickingAttached(this._flicking);
2608
2608
  this._activePanel = newActivePanel;
2609
+ this._nextPanel = null;
2609
2610
  flicking.camera.updateAdaptiveHeight();
2610
2611
  if (newActivePanel !== prevActivePanel) {
2611
2612
  flicking.trigger(new ComponentEvent(EVENTS.CHANGED, {
@@ -2642,6 +2643,7 @@ var Control = /*#__PURE__*/function () {
2642
2643
  isTrusted: (axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) || false,
2643
2644
  direction: getDirection((_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.position) !== null && _a !== void 0 ? _a : camera.position, position)
2644
2645
  });
2646
+ this._nextPanel = panel;
2645
2647
  flicking.trigger(event);
2646
2648
  if (event.isCanceled()) {
2647
2649
  throw new FlickingError(MESSAGE.STOP_CALLED_BY_USER, CODE.STOP_CALLED_BY_USER);
@@ -3229,19 +3231,20 @@ var StrictControl = /*#__PURE__*/function (_super) {
3229
3231
  * @return {Promise<void>} A Promise which will be resolved after reaching the target position<ko>해당 좌표 도달시에 resolve되는 Promise</ko>
3230
3232
  */
3231
3233
  __proto.moveToPosition = function (position, duration, axesEvent) {
3234
+ var _a;
3232
3235
  var flicking = getFlickingAttached(this._flicking);
3233
3236
  var camera = flicking.camera;
3234
- var activePanel = this._activePanel;
3237
+ var currentPanel = (_a = this._nextPanel) !== null && _a !== void 0 ? _a : this._activePanel;
3235
3238
  var axesRange = this._controller.range;
3236
3239
  var indexRange = this._indexRange;
3237
3240
  var cameraRange = camera.range;
3238
3241
  var state = this._controller.state;
3239
3242
  var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
3240
3243
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
3241
- if (!anchorAtPosition || !activePanel) {
3244
+ if (!anchorAtPosition || !currentPanel) {
3242
3245
  return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
3243
3246
  }
3244
- var prevPos = activePanel.position;
3247
+ var prevPos = currentPanel.position;
3245
3248
  var posDelta = flicking.animating ? state.delta : position - camera.position;
3246
3249
  var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
3247
3250
  var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
@@ -3258,7 +3261,7 @@ var StrictControl = /*#__PURE__*/function (_super) {
3258
3261
  var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
3259
3262
  targetPanel = targetAnchor.panel;
3260
3263
  targetPos = targetAnchor.position;
3261
- } else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
3264
+ } else if (isOverThreshold && anchorAtPosition.position !== currentPanel.position) {
3262
3265
  // Move to anchor at position
3263
3266
  targetPanel = anchorAtPosition.panel;
3264
3267
  targetPos = anchorAtPosition.position;
@@ -7819,7 +7822,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7819
7822
  * Flicking.VERSION; // ex) 4.0.0
7820
7823
  * ```
7821
7824
  */
7822
- Flicking.VERSION = "4.11.1";
7825
+ Flicking.VERSION = "4.11.2-beta.0";
7823
7826
  return Flicking;
7824
7827
  }(Component);
7825
7828