@egjs/flicking 4.7.2 → 4.8.1

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.7.2
7
+ version: 4.8.1
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')) :
@@ -826,7 +826,7 @@ version: 4.7.2
826
826
  * @ko Flicking 내부에서 알려진 오류 발생시 throw되는 에러
827
827
  * @property {number} code Error code<ko>에러 코드</ko>
828
828
  * @property {string} message Error message<ko>에러 메시지</ko>
829
- * @see {@link Constants.ERROR_CODE ERROR_CODE}
829
+ * @see {@link ERROR_CODE ERROR_CODE}
830
830
  * @example
831
831
  * ```ts
832
832
  * import Flicking, { FlickingError, ERROR_CODES } from "@egjs/flicking";
@@ -1985,8 +1985,15 @@ version: 4.7.2
1985
1985
  var flicking = ctx.flicking,
1986
1986
  axesEvent = ctx.axesEvent,
1987
1987
  transitTo = ctx.transitTo;
1988
+ var targetPanel = this._targetPanel;
1989
+ var control = flicking.control;
1988
1990
  this._delta = 0;
1989
1991
  flicking.control.updateInput();
1992
+
1993
+ if (flicking.changeOnHold && targetPanel) {
1994
+ control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
1995
+ }
1996
+
1990
1997
  var holdStartEvent = new Component.ComponentEvent(EVENTS.HOLD_START, {
1991
1998
  axesEvent: axesEvent
1992
1999
  });
@@ -2193,7 +2200,9 @@ version: 4.7.2
2193
2200
  };
2194
2201
 
2195
2202
  this._onAxesChange = function () {
2196
- _this._dragged = true;
2203
+ var _a;
2204
+
2205
+ _this._dragged = !!((_a = _this._panInput) === null || _a === void 0 ? void 0 : _a.isEnabled());
2197
2206
  };
2198
2207
 
2199
2208
  this._preventClickWhenDragged = function (e) {
@@ -3156,7 +3165,7 @@ version: 4.7.2
3156
3165
  var camera = flicking.camera;
3157
3166
  var activeAnchor = camera.findActiveAnchor();
3158
3167
  var anchorAtCamera = camera.findNearestAnchor(camera.position);
3159
- var state = flicking.control.controller.state;
3168
+ var state = this._controller.state;
3160
3169
 
3161
3170
  if (!activeAnchor || !anchorAtCamera) {
3162
3171
  return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
@@ -3174,10 +3183,13 @@ version: 4.7.2
3174
3183
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
3175
3184
  } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
3176
3185
  // Move to the adjacent panel
3177
- targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
3186
+ targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
3178
3187
  } else {
3179
3188
  // Restore to active panel
3180
- targetAnchor = anchorAtCamera;
3189
+ return this.moveToPanel(activeAnchor.panel, {
3190
+ duration: duration,
3191
+ axesEvent: axesEvent
3192
+ });
3181
3193
  }
3182
3194
 
3183
3195
  this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
@@ -3248,11 +3260,20 @@ version: 4.7.2
3248
3260
  }
3249
3261
  };
3250
3262
 
3251
- __proto._findAdjacentAnchor = function (posDelta, anchorAtCamera) {
3263
+ __proto._findAdjacentAnchor = function (position, posDelta, anchorAtCamera) {
3252
3264
  var _a;
3253
3265
 
3254
3266
  var flicking = getFlickingAttached(this._flicking);
3255
3267
  var camera = flicking.camera;
3268
+
3269
+ if (camera.circularEnabled) {
3270
+ var anchorIncludePosition = camera.findAnchorIncludePosition(position);
3271
+
3272
+ if (anchorIncludePosition && anchorIncludePosition.position !== anchorAtCamera.position) {
3273
+ return anchorIncludePosition;
3274
+ }
3275
+ }
3276
+
3256
3277
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
3257
3278
  return adjacentAnchor;
3258
3279
  };
@@ -3598,6 +3619,7 @@ version: 4.7.2
3598
3619
  var axesRange = this._controller.range;
3599
3620
  var indexRange = this._indexRange;
3600
3621
  var cameraRange = camera.range;
3622
+ var state = this._controller.state;
3601
3623
  var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
3602
3624
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
3603
3625
 
@@ -3606,7 +3628,8 @@ version: 4.7.2
3606
3628
  }
3607
3629
 
3608
3630
  var prevPos = activePanel.position;
3609
- var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
3631
+ var posDelta = flicking.animating ? state.delta : position - camera.position;
3632
+ var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
3610
3633
  var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
3611
3634
  var targetPos;
3612
3635
  var targetPanel;
@@ -6755,24 +6778,26 @@ version: 4.7.2
6755
6778
  preventClickOnDrag = _0 === void 0 ? true : _0,
6756
6779
  _1 = _b.disableOnInit,
6757
6780
  disableOnInit = _1 === void 0 ? false : _1,
6758
- _2 = _b.renderOnlyVisible,
6759
- renderOnlyVisible = _2 === void 0 ? false : _2,
6760
- _3 = _b.virtual,
6761
- virtual = _3 === void 0 ? null : _3,
6762
- _4 = _b.autoInit,
6763
- autoInit = _4 === void 0 ? true : _4,
6764
- _5 = _b.autoResize,
6765
- autoResize = _5 === void 0 ? true : _5,
6766
- _6 = _b.useResizeObserver,
6767
- useResizeObserver = _6 === void 0 ? true : _6,
6768
- _7 = _b.resizeDebounce,
6769
- resizeDebounce = _7 === void 0 ? 0 : _7,
6770
- _8 = _b.maxResizeDebounce,
6771
- maxResizeDebounce = _8 === void 0 ? 100 : _8,
6772
- _9 = _b.externalRenderer,
6773
- externalRenderer = _9 === void 0 ? null : _9,
6774
- _10 = _b.renderExternal,
6775
- renderExternal = _10 === void 0 ? null : _10;
6781
+ _2 = _b.changeOnHold,
6782
+ changeOnHold = _2 === void 0 ? false : _2,
6783
+ _3 = _b.renderOnlyVisible,
6784
+ renderOnlyVisible = _3 === void 0 ? false : _3,
6785
+ _4 = _b.virtual,
6786
+ virtual = _4 === void 0 ? null : _4,
6787
+ _5 = _b.autoInit,
6788
+ autoInit = _5 === void 0 ? true : _5,
6789
+ _6 = _b.autoResize,
6790
+ autoResize = _6 === void 0 ? true : _6,
6791
+ _7 = _b.useResizeObserver,
6792
+ useResizeObserver = _7 === void 0 ? true : _7,
6793
+ _8 = _b.resizeDebounce,
6794
+ resizeDebounce = _8 === void 0 ? 0 : _8,
6795
+ _9 = _b.maxResizeDebounce,
6796
+ maxResizeDebounce = _9 === void 0 ? 100 : _9,
6797
+ _10 = _b.externalRenderer,
6798
+ externalRenderer = _10 === void 0 ? null : _10,
6799
+ _11 = _b.renderExternal,
6800
+ renderExternal = _11 === void 0 ? null : _11;
6776
6801
 
6777
6802
  var _this = _super.call(this) || this; // Internal states
6778
6803
 
@@ -6805,6 +6830,7 @@ version: 4.7.2
6805
6830
  _this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
6806
6831
  _this._preventClickOnDrag = preventClickOnDrag;
6807
6832
  _this._disableOnInit = disableOnInit;
6833
+ _this._changeOnHold = changeOnHold;
6808
6834
  _this._renderOnlyVisible = renderOnlyVisible;
6809
6835
  _this._autoInit = autoInit;
6810
6836
  _this._autoResize = autoResize;
@@ -7561,6 +7587,24 @@ version: 4.7.2
7561
7587
  enumerable: false,
7562
7588
  configurable: true
7563
7589
  });
7590
+ Object.defineProperty(__proto, "changeOnHold", {
7591
+ /**
7592
+ * Change active panel index on mouse/touch hold while animating.
7593
+ * `index` of the `willChange`/`willRestore` event will be used as new index.
7594
+ * @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
7595
+ * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
7596
+ * @type {boolean}
7597
+ * @default false
7598
+ */
7599
+ get: function () {
7600
+ return this._changeOnHold;
7601
+ },
7602
+ set: function (val) {
7603
+ this._changeOnHold = val;
7604
+ },
7605
+ enumerable: false,
7606
+ configurable: true
7607
+ });
7564
7608
  Object.defineProperty(__proto, "renderOnlyVisible", {
7565
7609
  // PERFORMANCE
7566
7610
 
@@ -8241,6 +8285,8 @@ version: 4.7.2
8241
8285
  camera.updateAlignPos();
8242
8286
  camera.updateRange();
8243
8287
  camera.updateAnchors();
8288
+ camera.updateAdaptiveHeight();
8289
+ camera.updateOffset();
8244
8290
  return [4
8245
8291
  /*yield*/
8246
8292
  , renderer.render()];
@@ -8518,7 +8564,7 @@ version: 4.7.2
8518
8564
  */
8519
8565
 
8520
8566
 
8521
- Flicking.VERSION = "4.7.2";
8567
+ Flicking.VERSION = "4.8.1";
8522
8568
  return Flicking;
8523
8569
  }(Component);
8524
8570