@egjs/flicking 4.14.1-beta.3 → 4.14.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.
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.14.1-beta.3
7
+ version: 4.14.2-beta.0
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'), require('@cfcs/core')) :
@@ -1002,6 +1002,9 @@ version: 4.14.1-beta.3
1002
1002
  * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
1003
1003
  */
1004
1004
  var AutoResizer = /*#__PURE__*/function () {
1005
+ /**
1006
+ * @param flicking
1007
+ */
1005
1008
  function AutoResizer(flicking) {
1006
1009
  var _this = this;
1007
1010
  this._onResizeWrapper = function () {
@@ -2444,7 +2447,7 @@ version: 4.14.1-beta.3
2444
2447
  if (!axes) {
2445
2448
  return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING));
2446
2449
  }
2447
- var startPos = axes.get([POSITION_KEY])[POSITION_KEY];
2450
+ var startPos = this.getCurrentPosition();
2448
2451
  if (startPos === position) {
2449
2452
  var flicking = getFlickingAttached(this._flicking);
2450
2453
  flicking.camera.lookAt(position);
@@ -2488,6 +2491,14 @@ version: 4.14.1-beta.3
2488
2491
  animate();
2489
2492
  });
2490
2493
  };
2494
+ /**
2495
+ * 현재
2496
+ * @returns
2497
+ */
2498
+ __proto.getCurrentPosition = function () {
2499
+ var _a, _b;
2500
+ return (_b = (_a = this._axes) === null || _a === void 0 ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) !== null && _b !== void 0 ? _b : 0;
2501
+ };
2491
2502
  __proto.updateDirection = function () {
2492
2503
  var flicking = getFlickingAttached(this._flicking);
2493
2504
  var axes = this._axes;
@@ -2825,16 +2836,20 @@ version: 4.14.1-beta.3
2825
2836
  newActivePanel = _a.newActivePanel,
2826
2837
  axesEvent = _a.axesEvent;
2827
2838
  return __awaiter(this, void 0, void 0, function () {
2828
- var flicking, animate, state;
2839
+ var flicking, nextDuration, animate, state;
2829
2840
  var _this = this;
2830
2841
  return __generator(this, function (_b) {
2831
2842
  flicking = getFlickingAttached(this._flicking);
2843
+ nextDuration = duration;
2844
+ if (Math.abs(nextDuration - position) < 0.5) {
2845
+ nextDuration = 0;
2846
+ }
2832
2847
  animate = function () {
2833
- return _this._controller.animateTo(position, duration, axesEvent);
2848
+ return _this._controller.animateTo(position, nextDuration, axesEvent);
2834
2849
  };
2835
2850
  state = this._controller.state;
2836
2851
  state.targetPanel = newActivePanel;
2837
- if (duration <= 0) {
2852
+ if (nextDuration <= 0) {
2838
2853
  return [2 /*return*/, animate()];
2839
2854
  } else {
2840
2855
  return [2 /*return*/, animate().then(function () {
@@ -3425,8 +3440,9 @@ version: 4.14.1-beta.3
3425
3440
  var anchors = camera.anchorPoints;
3426
3441
  var firstAnchor = anchors[0];
3427
3442
  var lastAnchor = anchors[anchors.length - 1];
3428
- var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
3429
- var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
3443
+ // position bounce으로 인하여 범위를 넘어가야 동작하도록 변경
3444
+ var shouldBounceToFirst = position < cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
3445
+ var shouldBounceToLast = position > cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
3430
3446
  var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
3431
3447
  if (shouldBounceToFirst || shouldBounceToLast) {
3432
3448
  // In bounce area
@@ -8191,7 +8207,7 @@ version: 4.14.1-beta.3
8191
8207
  * Flicking.VERSION; // ex) 4.0.0
8192
8208
  * ```
8193
8209
  */
8194
- Flicking.VERSION = "4.14.1-beta.3";
8210
+ Flicking.VERSION = "4.14.2-beta.0";
8195
8211
  return Flicking;
8196
8212
  }(Component);
8197
8213