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