@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/declaration/Flicking.d.ts +5 -1
- package/dist/flicking.esm.js +73 -27
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +73 -27
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +90 -31
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/Flicking.ts +16 -0
- package/src/control/AxesController.ts +1 -1
- package/src/control/SnapControl.ts +16 -4
- package/src/control/StrictControl.ts +5 -1
- package/src/control/states/AnimatingState.ts +6 -0
- package/src/core/FlickingError.ts +1 -1
|
@@ -56,6 +56,7 @@ export interface FlickingOptions {
|
|
|
56
56
|
iOSEdgeSwipeThreshold: number;
|
|
57
57
|
preventClickOnDrag: boolean;
|
|
58
58
|
disableOnInit: boolean;
|
|
59
|
+
changeOnHold: boolean;
|
|
59
60
|
renderOnlyVisible: boolean;
|
|
60
61
|
virtual: VirtualOptions | null;
|
|
61
62
|
autoInit: boolean;
|
|
@@ -102,6 +103,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
102
103
|
private _iOSEdgeSwipeThreshold;
|
|
103
104
|
private _preventClickOnDrag;
|
|
104
105
|
private _disableOnInit;
|
|
106
|
+
private _changeOnHold;
|
|
105
107
|
private _renderOnlyVisible;
|
|
106
108
|
private _autoInit;
|
|
107
109
|
private _autoResize;
|
|
@@ -155,6 +157,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
155
157
|
get iOSEdgeSwipeThreshold(): FlickingOptions["iOSEdgeSwipeThreshold"];
|
|
156
158
|
get preventClickOnDrag(): FlickingOptions["preventClickOnDrag"];
|
|
157
159
|
get disableOnInit(): FlickingOptions["disableOnInit"];
|
|
160
|
+
get changeOnHold(): FlickingOptions["changeOnHold"];
|
|
158
161
|
get renderOnlyVisible(): FlickingOptions["renderOnlyVisible"];
|
|
159
162
|
get virtual(): VirtualManager;
|
|
160
163
|
get autoInit(): boolean;
|
|
@@ -190,10 +193,11 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
190
193
|
set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]);
|
|
191
194
|
set preventClickOnDrag(val: FlickingOptions["preventClickOnDrag"]);
|
|
192
195
|
set disableOnInit(val: FlickingOptions["disableOnInit"]);
|
|
196
|
+
set changeOnHold(val: FlickingOptions["changeOnHold"]);
|
|
193
197
|
set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]);
|
|
194
198
|
set autoResize(val: FlickingOptions["autoResize"]);
|
|
195
199
|
set useResizeObserver(val: FlickingOptions["useResizeObserver"]);
|
|
196
|
-
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, disableOnInit, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, maxResizeDebounce, externalRenderer, renderExternal }?: Partial<FlickingOptions>);
|
|
200
|
+
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, disableOnInit, changeOnHold, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, maxResizeDebounce, externalRenderer, renderExternal }?: Partial<FlickingOptions>);
|
|
197
201
|
init(): Promise<void>;
|
|
198
202
|
destroy(): void;
|
|
199
203
|
prev(duration?: number): Promise<void>;
|
package/dist/flicking.esm.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
|
+
version: 4.8.1
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -781,7 +781,7 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
|
781
781
|
* @ko Flicking 내부에서 알려진 오류 발생시 throw되는 에러
|
|
782
782
|
* @property {number} code Error code<ko>에러 코드</ko>
|
|
783
783
|
* @property {string} message Error message<ko>에러 메시지</ko>
|
|
784
|
-
* @see {@link
|
|
784
|
+
* @see {@link ERROR_CODE ERROR_CODE}
|
|
785
785
|
* @example
|
|
786
786
|
* ```ts
|
|
787
787
|
* import Flicking, { FlickingError, ERROR_CODES } from "@egjs/flicking";
|
|
@@ -1940,8 +1940,15 @@ function (_super) {
|
|
|
1940
1940
|
var flicking = ctx.flicking,
|
|
1941
1941
|
axesEvent = ctx.axesEvent,
|
|
1942
1942
|
transitTo = ctx.transitTo;
|
|
1943
|
+
var targetPanel = this._targetPanel;
|
|
1944
|
+
var control = flicking.control;
|
|
1943
1945
|
this._delta = 0;
|
|
1944
1946
|
flicking.control.updateInput();
|
|
1947
|
+
|
|
1948
|
+
if (flicking.changeOnHold && targetPanel) {
|
|
1949
|
+
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1945
1952
|
var holdStartEvent = new ComponentEvent(EVENTS.HOLD_START, {
|
|
1946
1953
|
axesEvent: axesEvent
|
|
1947
1954
|
});
|
|
@@ -2148,7 +2155,9 @@ function () {
|
|
|
2148
2155
|
};
|
|
2149
2156
|
|
|
2150
2157
|
this._onAxesChange = function () {
|
|
2151
|
-
|
|
2158
|
+
var _a;
|
|
2159
|
+
|
|
2160
|
+
_this._dragged = !!((_a = _this._panInput) === null || _a === void 0 ? void 0 : _a.isEnabled());
|
|
2152
2161
|
};
|
|
2153
2162
|
|
|
2154
2163
|
this._preventClickWhenDragged = function (e) {
|
|
@@ -3111,7 +3120,7 @@ function (_super) {
|
|
|
3111
3120
|
var camera = flicking.camera;
|
|
3112
3121
|
var activeAnchor = camera.findActiveAnchor();
|
|
3113
3122
|
var anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3114
|
-
var state =
|
|
3123
|
+
var state = this._controller.state;
|
|
3115
3124
|
|
|
3116
3125
|
if (!activeAnchor || !anchorAtCamera) {
|
|
3117
3126
|
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
@@ -3129,10 +3138,13 @@ function (_super) {
|
|
|
3129
3138
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3130
3139
|
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3131
3140
|
// Move to the adjacent panel
|
|
3132
|
-
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3141
|
+
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
3133
3142
|
} else {
|
|
3134
3143
|
// Restore to active panel
|
|
3135
|
-
|
|
3144
|
+
return this.moveToPanel(activeAnchor.panel, {
|
|
3145
|
+
duration: duration,
|
|
3146
|
+
axesEvent: axesEvent
|
|
3147
|
+
});
|
|
3136
3148
|
}
|
|
3137
3149
|
|
|
3138
3150
|
this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
|
|
@@ -3203,11 +3215,20 @@ function (_super) {
|
|
|
3203
3215
|
}
|
|
3204
3216
|
};
|
|
3205
3217
|
|
|
3206
|
-
__proto._findAdjacentAnchor = function (posDelta, anchorAtCamera) {
|
|
3218
|
+
__proto._findAdjacentAnchor = function (position, posDelta, anchorAtCamera) {
|
|
3207
3219
|
var _a;
|
|
3208
3220
|
|
|
3209
3221
|
var flicking = getFlickingAttached(this._flicking);
|
|
3210
3222
|
var camera = flicking.camera;
|
|
3223
|
+
|
|
3224
|
+
if (camera.circularEnabled) {
|
|
3225
|
+
var anchorIncludePosition = camera.findAnchorIncludePosition(position);
|
|
3226
|
+
|
|
3227
|
+
if (anchorIncludePosition && anchorIncludePosition.position !== anchorAtCamera.position) {
|
|
3228
|
+
return anchorIncludePosition;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3211
3232
|
var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
|
|
3212
3233
|
return adjacentAnchor;
|
|
3213
3234
|
};
|
|
@@ -3553,6 +3574,7 @@ function (_super) {
|
|
|
3553
3574
|
var axesRange = this._controller.range;
|
|
3554
3575
|
var indexRange = this._indexRange;
|
|
3555
3576
|
var cameraRange = camera.range;
|
|
3577
|
+
var state = this._controller.state;
|
|
3556
3578
|
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3557
3579
|
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3558
3580
|
|
|
@@ -3561,7 +3583,8 @@ function (_super) {
|
|
|
3561
3583
|
}
|
|
3562
3584
|
|
|
3563
3585
|
var prevPos = activePanel.position;
|
|
3564
|
-
var
|
|
3586
|
+
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3587
|
+
var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
|
|
3565
3588
|
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
3566
3589
|
var targetPos;
|
|
3567
3590
|
var targetPanel;
|
|
@@ -6662,24 +6685,26 @@ function (_super) {
|
|
|
6662
6685
|
preventClickOnDrag = _0 === void 0 ? true : _0,
|
|
6663
6686
|
_1 = _b.disableOnInit,
|
|
6664
6687
|
disableOnInit = _1 === void 0 ? false : _1,
|
|
6665
|
-
_2 = _b.
|
|
6666
|
-
|
|
6667
|
-
_3 = _b.
|
|
6668
|
-
|
|
6669
|
-
_4 = _b.
|
|
6670
|
-
|
|
6671
|
-
_5 = _b.
|
|
6672
|
-
|
|
6673
|
-
_6 = _b.
|
|
6674
|
-
|
|
6675
|
-
_7 = _b.
|
|
6676
|
-
|
|
6677
|
-
_8 = _b.
|
|
6678
|
-
|
|
6679
|
-
_9 = _b.
|
|
6680
|
-
|
|
6681
|
-
_10 = _b.
|
|
6682
|
-
|
|
6688
|
+
_2 = _b.changeOnHold,
|
|
6689
|
+
changeOnHold = _2 === void 0 ? false : _2,
|
|
6690
|
+
_3 = _b.renderOnlyVisible,
|
|
6691
|
+
renderOnlyVisible = _3 === void 0 ? false : _3,
|
|
6692
|
+
_4 = _b.virtual,
|
|
6693
|
+
virtual = _4 === void 0 ? null : _4,
|
|
6694
|
+
_5 = _b.autoInit,
|
|
6695
|
+
autoInit = _5 === void 0 ? true : _5,
|
|
6696
|
+
_6 = _b.autoResize,
|
|
6697
|
+
autoResize = _6 === void 0 ? true : _6,
|
|
6698
|
+
_7 = _b.useResizeObserver,
|
|
6699
|
+
useResizeObserver = _7 === void 0 ? true : _7,
|
|
6700
|
+
_8 = _b.resizeDebounce,
|
|
6701
|
+
resizeDebounce = _8 === void 0 ? 0 : _8,
|
|
6702
|
+
_9 = _b.maxResizeDebounce,
|
|
6703
|
+
maxResizeDebounce = _9 === void 0 ? 100 : _9,
|
|
6704
|
+
_10 = _b.externalRenderer,
|
|
6705
|
+
externalRenderer = _10 === void 0 ? null : _10,
|
|
6706
|
+
_11 = _b.renderExternal,
|
|
6707
|
+
renderExternal = _11 === void 0 ? null : _11;
|
|
6683
6708
|
|
|
6684
6709
|
var _this = _super.call(this) || this; // Internal states
|
|
6685
6710
|
|
|
@@ -6712,6 +6737,7 @@ function (_super) {
|
|
|
6712
6737
|
_this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
|
|
6713
6738
|
_this._preventClickOnDrag = preventClickOnDrag;
|
|
6714
6739
|
_this._disableOnInit = disableOnInit;
|
|
6740
|
+
_this._changeOnHold = changeOnHold;
|
|
6715
6741
|
_this._renderOnlyVisible = renderOnlyVisible;
|
|
6716
6742
|
_this._autoInit = autoInit;
|
|
6717
6743
|
_this._autoResize = autoResize;
|
|
@@ -7468,6 +7494,24 @@ function (_super) {
|
|
|
7468
7494
|
enumerable: false,
|
|
7469
7495
|
configurable: true
|
|
7470
7496
|
});
|
|
7497
|
+
Object.defineProperty(__proto, "changeOnHold", {
|
|
7498
|
+
/**
|
|
7499
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
7500
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
7501
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
7502
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
7503
|
+
* @type {boolean}
|
|
7504
|
+
* @default false
|
|
7505
|
+
*/
|
|
7506
|
+
get: function () {
|
|
7507
|
+
return this._changeOnHold;
|
|
7508
|
+
},
|
|
7509
|
+
set: function (val) {
|
|
7510
|
+
this._changeOnHold = val;
|
|
7511
|
+
},
|
|
7512
|
+
enumerable: false,
|
|
7513
|
+
configurable: true
|
|
7514
|
+
});
|
|
7471
7515
|
Object.defineProperty(__proto, "renderOnlyVisible", {
|
|
7472
7516
|
// PERFORMANCE
|
|
7473
7517
|
|
|
@@ -8148,6 +8192,8 @@ function (_super) {
|
|
|
8148
8192
|
camera.updateAlignPos();
|
|
8149
8193
|
camera.updateRange();
|
|
8150
8194
|
camera.updateAnchors();
|
|
8195
|
+
camera.updateAdaptiveHeight();
|
|
8196
|
+
camera.updateOffset();
|
|
8151
8197
|
return [4
|
|
8152
8198
|
/*yield*/
|
|
8153
8199
|
, renderer.render()];
|
|
@@ -8425,7 +8471,7 @@ function (_super) {
|
|
|
8425
8471
|
*/
|
|
8426
8472
|
|
|
8427
8473
|
|
|
8428
|
-
Flicking.VERSION = "4.
|
|
8474
|
+
Flicking.VERSION = "4.8.1";
|
|
8429
8475
|
return Flicking;
|
|
8430
8476
|
}(Component);
|
|
8431
8477
|
|