@egjs/flicking 4.7.1 → 4.8.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/TODO.md +3 -0
- package/declaration/Flicking.d.ts +5 -1
- package/dist/flicking.esm.js +55 -23
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +55 -23
- 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 +192 -124
- 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/SnapControl.ts +1 -1
- package/src/control/StrictControl.ts +5 -1
- package/src/control/states/AnimatingState.ts +6 -0
- package/src/core/FlickingError.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egjs/flicking",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
|
|
5
5
|
"main": "dist/flicking.js",
|
|
6
6
|
"module": "dist/flicking.esm.js",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"html-to-react": "^1.4.5",
|
|
110
110
|
"http-serve": "^1.0.1",
|
|
111
111
|
"husky": "^1.3.1",
|
|
112
|
-
"jsdoc-to-mdx": "^1.
|
|
112
|
+
"jsdoc-to-mdx": "^1.1.2",
|
|
113
113
|
"karma-typescript-es6-transform": "^5.5.2",
|
|
114
114
|
"node-sass": "^7.0.1",
|
|
115
115
|
"npm-run-all": "^4.1.5",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"typescript-transform-paths": "^2.2.3"
|
|
137
137
|
},
|
|
138
138
|
"dependencies": {
|
|
139
|
-
"@egjs/axes": "^3.2.
|
|
139
|
+
"@egjs/axes": "^3.2.2",
|
|
140
140
|
"@egjs/component": "^3.0.1",
|
|
141
141
|
"@egjs/imready": "^1.1.3",
|
|
142
142
|
"@egjs/list-differ": "^1.0.0"
|
package/src/Flicking.ts
CHANGED
|
@@ -78,6 +78,7 @@ export interface FlickingOptions {
|
|
|
78
78
|
iOSEdgeSwipeThreshold: number;
|
|
79
79
|
preventClickOnDrag: boolean;
|
|
80
80
|
disableOnInit: boolean;
|
|
81
|
+
changeOnHold: boolean;
|
|
81
82
|
|
|
82
83
|
// PERFORMANCE
|
|
83
84
|
renderOnlyVisible: boolean;
|
|
@@ -154,6 +155,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
154
155
|
private _iOSEdgeSwipeThreshold: FlickingOptions["iOSEdgeSwipeThreshold"];
|
|
155
156
|
private _preventClickOnDrag: FlickingOptions["preventClickOnDrag"];
|
|
156
157
|
private _disableOnInit: FlickingOptions["disableOnInit"];
|
|
158
|
+
private _changeOnHold: FlickingOptions["changeOnHold"];
|
|
157
159
|
|
|
158
160
|
private _renderOnlyVisible: FlickingOptions["renderOnlyVisible"];
|
|
159
161
|
|
|
@@ -570,6 +572,15 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
570
572
|
* @default false
|
|
571
573
|
*/
|
|
572
574
|
public get disableOnInit() { return this._disableOnInit; }
|
|
575
|
+
/**
|
|
576
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
577
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
578
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
579
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
580
|
+
* @type {boolean}
|
|
581
|
+
* @default false
|
|
582
|
+
*/
|
|
583
|
+
public get changeOnHold() { return this._changeOnHold; }
|
|
573
584
|
// PERFORMANCE
|
|
574
585
|
/**
|
|
575
586
|
* Whether to render visible panels only. This can dramatically increase performance when there're many panels
|
|
@@ -720,6 +731,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
720
731
|
}
|
|
721
732
|
|
|
722
733
|
public set disableOnInit(val: FlickingOptions["disableOnInit"]) { this._disableOnInit = val; }
|
|
734
|
+
public set changeOnHold(val: FlickingOptions["changeOnHold"]) { this._changeOnHold = val; }
|
|
723
735
|
// PERFORMANCE
|
|
724
736
|
public set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]) { this._renderOnlyVisible = val; }
|
|
725
737
|
// OTHERS
|
|
@@ -794,6 +806,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
794
806
|
iOSEdgeSwipeThreshold = 30,
|
|
795
807
|
preventClickOnDrag = true,
|
|
796
808
|
disableOnInit = false,
|
|
809
|
+
changeOnHold = false,
|
|
797
810
|
renderOnlyVisible = false,
|
|
798
811
|
virtual = null,
|
|
799
812
|
autoInit = true,
|
|
@@ -836,6 +849,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
836
849
|
this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
|
|
837
850
|
this._preventClickOnDrag = preventClickOnDrag;
|
|
838
851
|
this._disableOnInit = disableOnInit;
|
|
852
|
+
this._changeOnHold = changeOnHold;
|
|
839
853
|
this._renderOnlyVisible = renderOnlyVisible;
|
|
840
854
|
this._autoInit = autoInit;
|
|
841
855
|
this._autoResize = autoResize;
|
|
@@ -1275,6 +1289,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1275
1289
|
camera.updateAlignPos();
|
|
1276
1290
|
camera.updateRange();
|
|
1277
1291
|
camera.updateAnchors();
|
|
1292
|
+
camera.updateAdaptiveHeight();
|
|
1293
|
+
camera.updateOffset();
|
|
1278
1294
|
await renderer.render();
|
|
1279
1295
|
|
|
1280
1296
|
if (control.animating) {
|
|
@@ -89,7 +89,7 @@ class SnapControl extends Control {
|
|
|
89
89
|
const camera = flicking.camera;
|
|
90
90
|
const activeAnchor = camera.findActiveAnchor();
|
|
91
91
|
const anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
92
|
-
const state =
|
|
92
|
+
const state = this._controller.state;
|
|
93
93
|
|
|
94
94
|
if (!activeAnchor || !anchorAtCamera) {
|
|
95
95
|
return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(position), ERROR.CODE.POSITION_NOT_REACHABLE));
|
|
@@ -194,6 +194,7 @@ class StrictControl extends Control {
|
|
|
194
194
|
const axesRange = this._controller.range;
|
|
195
195
|
const indexRange = this._indexRange;
|
|
196
196
|
const cameraRange = camera.range;
|
|
197
|
+
const state = this._controller.state;
|
|
197
198
|
|
|
198
199
|
const clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
199
200
|
const anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
@@ -203,8 +204,11 @@ class StrictControl extends Control {
|
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
const prevPos = activePanel.position;
|
|
207
|
+
const posDelta = flicking.animating
|
|
208
|
+
? state.delta
|
|
209
|
+
: position - camera.position;
|
|
206
210
|
|
|
207
|
-
const isOverThreshold = Math.abs(
|
|
211
|
+
const isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
|
|
208
212
|
const adjacentAnchor = (position > prevPos)
|
|
209
213
|
? camera.getNextAnchor(anchorAtPosition)
|
|
210
214
|
: camera.getPrevAnchor(anchorAtPosition);
|
|
@@ -32,10 +32,16 @@ class AnimatingState extends State {
|
|
|
32
32
|
|
|
33
33
|
public onHold(ctx: Parameters<State["onHold"]>[0]): void {
|
|
34
34
|
const { flicking, axesEvent, transitTo } = ctx;
|
|
35
|
+
const targetPanel = this._targetPanel;
|
|
36
|
+
const control = flicking.control;
|
|
35
37
|
|
|
36
38
|
this._delta = 0;
|
|
37
39
|
flicking.control.updateInput();
|
|
38
40
|
|
|
41
|
+
if (flicking.changeOnHold && targetPanel) {
|
|
42
|
+
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
const holdStartEvent = new ComponentEvent(EVENTS.HOLD_START, { axesEvent });
|
|
40
46
|
flicking.trigger(holdStartEvent);
|
|
41
47
|
|
|
@@ -10,7 +10,7 @@ import { setPrototypeOf } from "../utils";
|
|
|
10
10
|
* @ko Flicking 내부에서 알려진 오류 발생시 throw되는 에러
|
|
11
11
|
* @property {number} code Error code<ko>에러 코드</ko>
|
|
12
12
|
* @property {string} message Error message<ko>에러 메시지</ko>
|
|
13
|
-
* @see {@link
|
|
13
|
+
* @see {@link ERROR_CODE ERROR_CODE}
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
16
16
|
* import Flicking, { FlickingError, ERROR_CODES } from "@egjs/flicking";
|