@egjs/flicking 4.12.1-beta.2 → 4.12.1-beta.4

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.
@@ -40,6 +40,6 @@ declare abstract class Control {
40
40
  newActivePanel: Panel;
41
41
  axesEvent?: OnRelease;
42
42
  }): Promise<void>;
43
- private _getPosition;
43
+ protected _getPosition(panel: Panel, direction?: ValueOf<typeof DIRECTION>): number;
44
44
  }
45
45
  export default Control;
@@ -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.12.1-beta.2
7
+ version: 4.12.1-beta.4
8
8
  */
9
9
  'use strict';
10
10
 
@@ -2917,7 +2917,6 @@ var SnapControl = /*#__PURE__*/function (_super) {
2917
2917
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
2918
2918
  } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
2919
2919
  // Move to the adjacent panel
2920
- // console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
2921
2920
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
2922
2921
  } else {
2923
2922
  // Fallback to nearest panel from current camera
@@ -2926,11 +2925,14 @@ var SnapControl = /*#__PURE__*/function (_super) {
2926
2925
  axesEvent: axesEvent
2927
2926
  });
2928
2927
  }
2929
- this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
2928
+ var nextPanel = targetAnchor.panel;
2929
+ var direction = posDelta === 0 || activeAnchor === targetAnchor ? DIRECTION.NONE : posDelta > 0 ? DIRECTION.NEXT : DIRECTION.PREV;
2930
+ var nextPosition = this._getPosition(nextPanel, direction);
2931
+ this._triggerIndexChangeEvent(nextPanel, position, axesEvent);
2930
2932
  return this._animateToPosition({
2931
- position: camera.clampToReachablePosition(targetAnchor.position),
2933
+ position: camera.clampToReachablePosition(nextPosition),
2932
2934
  duration: duration,
2933
- newActivePanel: targetAnchor.panel,
2935
+ newActivePanel: nextPanel,
2934
2936
  axesEvent: axesEvent
2935
2937
  });
2936
2938
  };
@@ -2940,12 +2942,13 @@ var SnapControl = /*#__PURE__*/function (_super) {
2940
2942
  var count = this._count;
2941
2943
  var currentPos = camera.position;
2942
2944
  var clampedPosition = camera.clampToReachablePosition(position);
2945
+ var nearestAnchor = camera.findNearestAnchor(clampedPosition);
2943
2946
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
2944
- if (!anchorAtCamera || !anchorAtPosition) {
2947
+ if (!anchorAtCamera || !anchorAtPosition || !nearestAnchor) {
2945
2948
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
2946
2949
  }
2947
2950
  if (!isFinite(count)) {
2948
- return anchorAtPosition;
2951
+ return nearestAnchor;
2949
2952
  }
2950
2953
  var panelCount = flicking.panelCount;
2951
2954
  var anchors = camera.anchorPoints;
@@ -2992,7 +2995,6 @@ var SnapControl = /*#__PURE__*/function (_super) {
2992
2995
  return anchorIncludePosition;
2993
2996
  }
2994
2997
  }
2995
- // console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
2996
2998
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
2997
2999
  return adjacentAnchor;
2998
3000
  };
@@ -7923,7 +7925,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7923
7925
  * Flicking.VERSION; // ex) 4.0.0
7924
7926
  * ```
7925
7927
  */
7926
- Flicking.VERSION = "4.12.1-beta.2";
7928
+ Flicking.VERSION = "4.12.1-beta.4";
7927
7929
  return Flicking;
7928
7930
  }(Component);
7929
7931