@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.
@@ -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() :
@@ -7145,7 +7145,6 @@ version: 4.12.1-beta.2
7145
7145
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
7146
7146
  } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
7147
7147
  // Move to the adjacent panel
7148
- // console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
7149
7148
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
7150
7149
  } else {
7151
7150
  // Fallback to nearest panel from current camera
@@ -7154,11 +7153,14 @@ version: 4.12.1-beta.2
7154
7153
  axesEvent: axesEvent
7155
7154
  });
7156
7155
  }
7157
- this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
7156
+ var nextPanel = targetAnchor.panel;
7157
+ var direction = posDelta === 0 || activeAnchor === targetAnchor ? DIRECTION.NONE : posDelta > 0 ? DIRECTION.NEXT : DIRECTION.PREV;
7158
+ var nextPosition = this._getPosition(nextPanel, direction);
7159
+ this._triggerIndexChangeEvent(nextPanel, position, axesEvent);
7158
7160
  return this._animateToPosition({
7159
- position: camera.clampToReachablePosition(targetAnchor.position),
7161
+ position: camera.clampToReachablePosition(nextPosition),
7160
7162
  duration: duration,
7161
- newActivePanel: targetAnchor.panel,
7163
+ newActivePanel: nextPanel,
7162
7164
  axesEvent: axesEvent
7163
7165
  });
7164
7166
  };
@@ -7168,12 +7170,13 @@ version: 4.12.1-beta.2
7168
7170
  var count = this._count;
7169
7171
  var currentPos = camera.position;
7170
7172
  var clampedPosition = camera.clampToReachablePosition(position);
7173
+ var nearestAnchor = camera.findNearestAnchor(clampedPosition);
7171
7174
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
7172
- if (!anchorAtCamera || !anchorAtPosition) {
7175
+ if (!anchorAtCamera || !anchorAtPosition || !nearestAnchor) {
7173
7176
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
7174
7177
  }
7175
7178
  if (!isFinite(count)) {
7176
- return anchorAtPosition;
7179
+ return nearestAnchor;
7177
7180
  }
7178
7181
  var panelCount = flicking.panelCount;
7179
7182
  var anchors = camera.anchorPoints;
@@ -7220,7 +7223,6 @@ version: 4.12.1-beta.2
7220
7223
  return anchorIncludePosition;
7221
7224
  }
7222
7225
  }
7223
- // console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
7224
7226
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
7225
7227
  return adjacentAnchor;
7226
7228
  };
@@ -13069,7 +13071,7 @@ version: 4.12.1-beta.2
13069
13071
  * Flicking.VERSION; // ex) 4.0.0
13070
13072
  * ```
13071
13073
  */
13072
- Flicking.VERSION = "4.12.1-beta.2";
13074
+ Flicking.VERSION = "4.12.1-beta.4";
13073
13075
  return Flicking;
13074
13076
  }(Component);
13075
13077