@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.
package/dist/flicking.js CHANGED
@@ -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
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
@@ -2965,7 +2965,6 @@ version: 4.12.1-beta.2
2965
2965
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
2966
2966
  } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
2967
2967
  // Move to the adjacent panel
2968
- // console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
2969
2968
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
2970
2969
  } else {
2971
2970
  // Fallback to nearest panel from current camera
@@ -2974,11 +2973,14 @@ version: 4.12.1-beta.2
2974
2973
  axesEvent: axesEvent
2975
2974
  });
2976
2975
  }
2977
- this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
2976
+ var nextPanel = targetAnchor.panel;
2977
+ var direction = posDelta === 0 || activeAnchor === targetAnchor ? DIRECTION.NONE : posDelta > 0 ? DIRECTION.NEXT : DIRECTION.PREV;
2978
+ var nextPosition = this._getPosition(nextPanel, direction);
2979
+ this._triggerIndexChangeEvent(nextPanel, position, axesEvent);
2978
2980
  return this._animateToPosition({
2979
- position: camera.clampToReachablePosition(targetAnchor.position),
2981
+ position: camera.clampToReachablePosition(nextPosition),
2980
2982
  duration: duration,
2981
- newActivePanel: targetAnchor.panel,
2983
+ newActivePanel: nextPanel,
2982
2984
  axesEvent: axesEvent
2983
2985
  });
2984
2986
  };
@@ -2988,12 +2990,13 @@ version: 4.12.1-beta.2
2988
2990
  var count = this._count;
2989
2991
  var currentPos = camera.position;
2990
2992
  var clampedPosition = camera.clampToReachablePosition(position);
2993
+ var nearestAnchor = camera.findNearestAnchor(clampedPosition);
2991
2994
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
2992
- if (!anchorAtCamera || !anchorAtPosition) {
2995
+ if (!anchorAtCamera || !anchorAtPosition || !nearestAnchor) {
2993
2996
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
2994
2997
  }
2995
2998
  if (!isFinite(count)) {
2996
- return anchorAtPosition;
2999
+ return nearestAnchor;
2997
3000
  }
2998
3001
  var panelCount = flicking.panelCount;
2999
3002
  var anchors = camera.anchorPoints;
@@ -3040,7 +3043,6 @@ version: 4.12.1-beta.2
3040
3043
  return anchorIncludePosition;
3041
3044
  }
3042
3045
  }
3043
- // console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
3044
3046
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
3045
3047
  return adjacentAnchor;
3046
3048
  };
@@ -8019,7 +8021,7 @@ version: 4.12.1-beta.2
8019
8021
  * Flicking.VERSION; // ex) 4.0.0
8020
8022
  * ```
8021
8023
  */
8022
- Flicking.VERSION = "4.12.1-beta.2";
8024
+ Flicking.VERSION = "4.12.1-beta.4";
8023
8025
  return Flicking;
8024
8026
  }(Component);
8025
8027