@egjs/flicking 4.14.1 → 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.
@@ -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
7
+ version: 4.14.2-beta.0
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -953,6 +953,9 @@ var Viewport = /*#__PURE__*/function () {
953
953
  * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
954
954
  */
955
955
  var AutoResizer = /*#__PURE__*/function () {
956
+ /**
957
+ * @param flicking
958
+ */
956
959
  function AutoResizer(flicking) {
957
960
  var _this = this;
958
961
  this._onResizeWrapper = function () {
@@ -2395,7 +2398,7 @@ var AxesController = /*#__PURE__*/function () {
2395
2398
  if (!axes) {
2396
2399
  return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING));
2397
2400
  }
2398
- var startPos = axes.get([POSITION_KEY])[POSITION_KEY];
2401
+ var startPos = this.getCurrentPosition();
2399
2402
  if (startPos === position) {
2400
2403
  var flicking = getFlickingAttached(this._flicking);
2401
2404
  flicking.camera.lookAt(position);
@@ -2439,6 +2442,14 @@ var AxesController = /*#__PURE__*/function () {
2439
2442
  animate();
2440
2443
  });
2441
2444
  };
2445
+ /**
2446
+ * 현재
2447
+ * @returns
2448
+ */
2449
+ __proto.getCurrentPosition = function () {
2450
+ var _a, _b;
2451
+ return (_b = (_a = this._axes) === null || _a === void 0 ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) !== null && _b !== void 0 ? _b : 0;
2452
+ };
2442
2453
  __proto.updateDirection = function () {
2443
2454
  var flicking = getFlickingAttached(this._flicking);
2444
2455
  var axes = this._axes;
@@ -2776,16 +2787,20 @@ var Control = /*#__PURE__*/function () {
2776
2787
  newActivePanel = _a.newActivePanel,
2777
2788
  axesEvent = _a.axesEvent;
2778
2789
  return __awaiter(this, void 0, void 0, function () {
2779
- var flicking, animate, state;
2790
+ var flicking, nextDuration, animate, state;
2780
2791
  var _this = this;
2781
2792
  return __generator(this, function (_b) {
2782
2793
  flicking = getFlickingAttached(this._flicking);
2794
+ nextDuration = duration;
2795
+ if (Math.abs(nextDuration - position) < 0.5) {
2796
+ nextDuration = 0;
2797
+ }
2783
2798
  animate = function () {
2784
- return _this._controller.animateTo(position, duration, axesEvent);
2799
+ return _this._controller.animateTo(position, nextDuration, axesEvent);
2785
2800
  };
2786
2801
  state = this._controller.state;
2787
2802
  state.targetPanel = newActivePanel;
2788
- if (duration <= 0) {
2803
+ if (nextDuration <= 0) {
2789
2804
  return [2 /*return*/, animate()];
2790
2805
  } else {
2791
2806
  return [2 /*return*/, animate().then(function () {
@@ -3376,8 +3391,9 @@ var StrictControl = /*#__PURE__*/function (_super) {
3376
3391
  var anchors = camera.anchorPoints;
3377
3392
  var firstAnchor = anchors[0];
3378
3393
  var lastAnchor = anchors[anchors.length - 1];
3379
- var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
3380
- var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
3394
+ // position bounce으로 인하여 범위를 넘어가야 동작하도록 변경
3395
+ var shouldBounceToFirst = position < cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
3396
+ var shouldBounceToLast = position > cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
3381
3397
  var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
3382
3398
  if (shouldBounceToFirst || shouldBounceToLast) {
3383
3399
  // In bounce area
@@ -8094,7 +8110,7 @@ var Flicking = /*#__PURE__*/function (_super) {
8094
8110
  * Flicking.VERSION; // ex) 4.0.0
8095
8111
  * ```
8096
8112
  */
8097
- Flicking.VERSION = "4.14.1";
8113
+ Flicking.VERSION = "4.14.2-beta.0";
8098
8114
  return Flicking;
8099
8115
  }(Component);
8100
8116