@egjs/flicking 4.13.1 → 4.13.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.
- package/declaration/Flicking.d.ts +1 -12
- package/declaration/control/Control.d.ts +1 -1
- package/declaration/core/AutoResizer.d.ts +0 -5
- package/dist/flicking.cjs.js +25 -202
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +25 -202
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +25 -202
- 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 +43 -205
- 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 +2 -2
- package/src/Flicking.ts +153 -522
- package/src/camera/mode/CameraMode.ts +1 -2
- package/src/control/Control.ts +1 -1
- package/src/control/SnapControl.ts +8 -1
- package/src/core/AutoResizer.ts +11 -110
- package/src/renderer/Renderer.ts +0 -13
- package/src/utils.ts +1 -6
- package/core-packages-link.js +0 -38
- package/debug/example/index.html +0 -82
package/src/Flicking.ts
CHANGED
|
@@ -10,52 +10,13 @@ import AutoResizer from "./core/AutoResizer";
|
|
|
10
10
|
import { Panel } from "./core/panel";
|
|
11
11
|
import { VanillaElementProvider } from "./core/panel/provider";
|
|
12
12
|
import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
|
|
13
|
-
import {
|
|
14
|
-
Control,
|
|
15
|
-
SnapControl,
|
|
16
|
-
SnapControlOptions,
|
|
17
|
-
FreeControl,
|
|
18
|
-
StrictControl,
|
|
19
|
-
FreeControlOptions,
|
|
20
|
-
StrictControlOptions
|
|
21
|
-
} from "./control";
|
|
13
|
+
import { Control, SnapControl, SnapControlOptions, FreeControl, StrictControl, FreeControlOptions, StrictControlOptions } from "./control";
|
|
22
14
|
import { Camera } from "./camera";
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
VanillaRenderer,
|
|
26
|
-
ExternalRenderer,
|
|
27
|
-
RendererOptions,
|
|
28
|
-
NormalRenderingStrategy,
|
|
29
|
-
VirtualRenderingStrategy
|
|
30
|
-
} from "./renderer";
|
|
31
|
-
import {
|
|
32
|
-
EVENTS,
|
|
33
|
-
ALIGN,
|
|
34
|
-
MOVE_TYPE,
|
|
35
|
-
DIRECTION,
|
|
36
|
-
CIRCULAR_FALLBACK
|
|
37
|
-
} from "./const/external";
|
|
15
|
+
import { Renderer, VanillaRenderer, ExternalRenderer, RendererOptions, NormalRenderingStrategy, VirtualRenderingStrategy } from "./renderer";
|
|
16
|
+
import { EVENTS, ALIGN, MOVE_TYPE, DIRECTION, CIRCULAR_FALLBACK } from "./const/external";
|
|
38
17
|
import * as ERROR from "./const/error";
|
|
39
18
|
import { findIndex, getElement, includes, parseElement } from "./utils";
|
|
40
|
-
import {
|
|
41
|
-
HoldStartEvent,
|
|
42
|
-
HoldEndEvent,
|
|
43
|
-
MoveStartEvent,
|
|
44
|
-
SelectEvent,
|
|
45
|
-
MoveEvent,
|
|
46
|
-
MoveEndEvent,
|
|
47
|
-
WillChangeEvent,
|
|
48
|
-
WillRestoreEvent,
|
|
49
|
-
NeedPanelEvent,
|
|
50
|
-
VisibleChangeEvent,
|
|
51
|
-
ReachEdgeEvent,
|
|
52
|
-
ReadyEvent,
|
|
53
|
-
AfterResizeEvent,
|
|
54
|
-
BeforeResizeEvent,
|
|
55
|
-
ChangedEvent,
|
|
56
|
-
RestoredEvent,
|
|
57
|
-
PanelChangeEvent
|
|
58
|
-
} from "./type/event";
|
|
19
|
+
import { HoldStartEvent, HoldEndEvent, MoveStartEvent, SelectEvent, MoveEvent, MoveEndEvent, WillChangeEvent, WillRestoreEvent, NeedPanelEvent, VisibleChangeEvent, ReachEdgeEvent, ReadyEvent, AfterResizeEvent, BeforeResizeEvent, ChangedEvent, RestoredEvent, PanelChangeEvent } from "./type/event";
|
|
59
20
|
import { LiteralUnion, ValueOf } from "./type/internal";
|
|
60
21
|
import { ElementLike, Plugin, Status, MoveTypeOptions } from "./type/external";
|
|
61
22
|
|
|
@@ -87,10 +48,7 @@ export interface FlickingEvents {
|
|
|
87
48
|
*/
|
|
88
49
|
export interface FlickingOptions {
|
|
89
50
|
// UI / LAYOUT
|
|
90
|
-
align:
|
|
91
|
-
| LiteralUnion<ValueOf<typeof ALIGN>>
|
|
92
|
-
| number
|
|
93
|
-
| { panel: number | string; camera: number | string };
|
|
51
|
+
align: LiteralUnion<ValueOf<typeof ALIGN>> | number | { panel: number | string; camera: number | string };
|
|
94
52
|
defaultIndex: number;
|
|
95
53
|
horizontal: boolean;
|
|
96
54
|
circular: boolean;
|
|
@@ -113,9 +71,7 @@ export interface FlickingOptions {
|
|
|
113
71
|
|
|
114
72
|
// INPUT
|
|
115
73
|
inputType: string[];
|
|
116
|
-
moveType:
|
|
117
|
-
| ValueOf<typeof MOVE_TYPE>
|
|
118
|
-
| MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
|
|
74
|
+
moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
|
|
119
75
|
threshold: number;
|
|
120
76
|
dragThreshold: number;
|
|
121
77
|
interruptable: boolean;
|
|
@@ -135,11 +91,9 @@ export interface FlickingOptions {
|
|
|
135
91
|
autoResize: boolean;
|
|
136
92
|
useResizeObserver: boolean;
|
|
137
93
|
resizeDebounce: number;
|
|
138
|
-
observePanelResize: boolean;
|
|
139
94
|
maxResizeDebounce: number;
|
|
140
95
|
useFractionalSize: boolean;
|
|
141
96
|
externalRenderer: ExternalRenderer | null;
|
|
142
|
-
optimizeSizeUpdate: boolean;
|
|
143
97
|
|
|
144
98
|
// @deprecated
|
|
145
99
|
renderExternal: {
|
|
@@ -214,17 +168,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
214
168
|
private _autoResize: FlickingOptions["autoResize"];
|
|
215
169
|
private _useResizeObserver: FlickingOptions["useResizeObserver"];
|
|
216
170
|
private _resizeDebounce: FlickingOptions["resizeDebounce"];
|
|
217
|
-
private _observePanelResize: FlickingOptions["observePanelResize"];
|
|
218
171
|
private _maxResizeDebounce: FlickingOptions["maxResizeDebounce"];
|
|
219
172
|
private _useFractionalSize: FlickingOptions["useFractionalSize"];
|
|
220
173
|
private _externalRenderer: FlickingOptions["externalRenderer"];
|
|
221
174
|
private _renderExternal: FlickingOptions["renderExternal"];
|
|
222
|
-
private _optimizeSizeUpdate: FlickingOptions["optimizeSizeUpdate"];
|
|
223
175
|
|
|
224
176
|
// Internal State
|
|
225
177
|
private _initialized: boolean;
|
|
226
178
|
private _plugins: Plugin[];
|
|
227
|
-
private _isResizing: boolean;
|
|
228
179
|
|
|
229
180
|
// Components
|
|
230
181
|
/**
|
|
@@ -237,10 +188,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
237
188
|
* @see SnapControl
|
|
238
189
|
* @see FreeControl
|
|
239
190
|
*/
|
|
240
|
-
public get control() {
|
|
241
|
-
return this._control;
|
|
242
|
-
}
|
|
243
|
-
|
|
191
|
+
public get control() { return this._control; }
|
|
244
192
|
/**
|
|
245
193
|
* {@link Camera} instance of the Flicking
|
|
246
194
|
* @ko 현재 Flicking에 활성화된 {@link Camera} 인스턴스
|
|
@@ -252,10 +200,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
252
200
|
* @see BoundCamera
|
|
253
201
|
* @see CircularCamera
|
|
254
202
|
*/
|
|
255
|
-
public get camera() {
|
|
256
|
-
return this._camera;
|
|
257
|
-
}
|
|
258
|
-
|
|
203
|
+
public get camera() { return this._camera; }
|
|
259
204
|
/**
|
|
260
205
|
* {@link Renderer} instance of the Flicking
|
|
261
206
|
* @ko 현재 Flicking에 활성화된 {@link Renderer} 인스턴스
|
|
@@ -266,10 +211,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
266
211
|
* @see VanillaRenderer
|
|
267
212
|
* @see ExternalRenderer
|
|
268
213
|
*/
|
|
269
|
-
public get renderer() {
|
|
270
|
-
return this._renderer;
|
|
271
|
-
}
|
|
272
|
-
|
|
214
|
+
public get renderer() { return this._renderer; }
|
|
273
215
|
/**
|
|
274
216
|
* A component that manages viewport size
|
|
275
217
|
* @ko 뷰포트 크기 정보를 담당하는 컴포넌트
|
|
@@ -278,13 +220,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
278
220
|
* @see Viewport
|
|
279
221
|
*/
|
|
280
222
|
public get viewport() { return this._viewport; }
|
|
281
|
-
/**
|
|
282
|
-
* {@link AutoResizer} instance of the Flicking
|
|
283
|
-
* @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
|
|
284
|
-
* @internal
|
|
285
|
-
* @readonly
|
|
286
|
-
*/
|
|
287
|
-
public get autoResizer() { return this._autoResizer; }
|
|
288
223
|
// Internal States
|
|
289
224
|
/**
|
|
290
225
|
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
@@ -295,10 +230,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
295
230
|
* @default false
|
|
296
231
|
* @readonly
|
|
297
232
|
*/
|
|
298
|
-
public get initialized() {
|
|
299
|
-
return this._initialized;
|
|
300
|
-
}
|
|
301
|
-
|
|
233
|
+
public get initialized() { return this._initialized; }
|
|
302
234
|
/**
|
|
303
235
|
* Whether the `circular` option is enabled.
|
|
304
236
|
* The {@link Flicking#circular circular} option can't be enabled when sum of the panel sizes are too small.
|
|
@@ -308,10 +240,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
308
240
|
* @default false
|
|
309
241
|
* @readonly
|
|
310
242
|
*/
|
|
311
|
-
public get circularEnabled() {
|
|
312
|
-
return this._camera.circularEnabled;
|
|
313
|
-
}
|
|
314
|
-
|
|
243
|
+
public get circularEnabled() { return this._camera.circularEnabled; }
|
|
315
244
|
/**
|
|
316
245
|
* Whether the `virtual` option is enabled.
|
|
317
246
|
* The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
|
|
@@ -321,10 +250,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
321
250
|
* @default false
|
|
322
251
|
* @readonly
|
|
323
252
|
*/
|
|
324
|
-
public get virtualEnabled() {
|
|
325
|
-
return this._panelsPerView > 0 && this._virtual != null;
|
|
326
|
-
}
|
|
327
|
-
|
|
253
|
+
public get virtualEnabled() { return this._panelsPerView > 0 && this._virtual != null; }
|
|
328
254
|
/**
|
|
329
255
|
* Index number of the {@link Flicking#currentPanel currentPanel}
|
|
330
256
|
* @ko {@link Flicking#currentPanel currentPanel}의 인덱스 번호
|
|
@@ -332,20 +258,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
332
258
|
* @default 0
|
|
333
259
|
* @readonly
|
|
334
260
|
*/
|
|
335
|
-
public get index() {
|
|
336
|
-
return this._control.activeIndex;
|
|
337
|
-
}
|
|
338
|
-
|
|
261
|
+
public get index() { return this._control.activeIndex; }
|
|
339
262
|
/**
|
|
340
263
|
* The root(`.flicking-viewport`) element
|
|
341
264
|
* @ko root(`.flicking-viewport`) 엘리먼트
|
|
342
265
|
* @type {HTMLElement}
|
|
343
266
|
* @readonly
|
|
344
267
|
*/
|
|
345
|
-
public get element() {
|
|
346
|
-
return this._viewport.element;
|
|
347
|
-
}
|
|
348
|
-
|
|
268
|
+
public get element() { return this._viewport.element; }
|
|
349
269
|
/**
|
|
350
270
|
* Currently active panel
|
|
351
271
|
* @ko 현재 선택된 패널
|
|
@@ -353,10 +273,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
353
273
|
* @readonly
|
|
354
274
|
* @see Panel
|
|
355
275
|
*/
|
|
356
|
-
public get currentPanel() {
|
|
357
|
-
return this._control.activePanel;
|
|
358
|
-
}
|
|
359
|
-
|
|
276
|
+
public get currentPanel() { return this._control.activePanel; }
|
|
360
277
|
/**
|
|
361
278
|
* Array of panels
|
|
362
279
|
* @ko 전체 패널들의 배열
|
|
@@ -364,20 +281,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
364
281
|
* @readonly
|
|
365
282
|
* @see Panel
|
|
366
283
|
*/
|
|
367
|
-
public get panels() {
|
|
368
|
-
return this._renderer.panels;
|
|
369
|
-
}
|
|
370
|
-
|
|
284
|
+
public get panels() { return this._renderer.panels; }
|
|
371
285
|
/**
|
|
372
286
|
* Count of panels
|
|
373
287
|
* @ko 전체 패널의 개수
|
|
374
288
|
* @type {number}
|
|
375
289
|
* @readonly
|
|
376
290
|
*/
|
|
377
|
-
public get panelCount() {
|
|
378
|
-
return this._renderer.panelCount;
|
|
379
|
-
}
|
|
380
|
-
|
|
291
|
+
public get panelCount() { return this._renderer.panelCount; }
|
|
381
292
|
/**
|
|
382
293
|
* Array of panels that is visible at the current position
|
|
383
294
|
* @ko 현재 보이는 패널의 배열
|
|
@@ -385,39 +296,28 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
385
296
|
* @readonly
|
|
386
297
|
* @see Panel
|
|
387
298
|
*/
|
|
388
|
-
public get visiblePanels() {
|
|
389
|
-
return this._camera.visiblePanels;
|
|
390
|
-
}
|
|
391
|
-
|
|
299
|
+
public get visiblePanels() { return this._camera.visiblePanels; }
|
|
392
300
|
/**
|
|
393
301
|
* Whether Flicking's animating
|
|
394
302
|
* @ko 현재 애니메이션 동작 여부
|
|
395
303
|
* @type {boolean}
|
|
396
304
|
* @readonly
|
|
397
305
|
*/
|
|
398
|
-
public get animating() {
|
|
399
|
-
return this._control.animating;
|
|
400
|
-
}
|
|
401
|
-
|
|
306
|
+
public get animating() { return this._control.animating; }
|
|
402
307
|
/**
|
|
403
308
|
* Whether user is clicking or touching
|
|
404
309
|
* @ko 현재 사용자가 클릭/터치중인지 여부
|
|
405
310
|
* @type {boolean}
|
|
406
311
|
* @readonly
|
|
407
312
|
*/
|
|
408
|
-
public get holding() {
|
|
409
|
-
return this._control.holding;
|
|
410
|
-
}
|
|
411
|
-
|
|
313
|
+
public get holding() { return this._control.holding; }
|
|
412
314
|
/**
|
|
413
315
|
* A current list of activated plugins
|
|
414
316
|
* @ko 현재 활성화된 플러그인 목록
|
|
415
317
|
* @type {Plugin[]}
|
|
416
318
|
* @readonly
|
|
417
319
|
*/
|
|
418
|
-
public get activePlugins() {
|
|
419
|
-
return this._plugins;
|
|
420
|
-
}
|
|
320
|
+
public get activePlugins() { return this._plugins; }
|
|
421
321
|
|
|
422
322
|
// Options Getter
|
|
423
323
|
// UI / LAYOUT
|
|
@@ -449,10 +349,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
449
349
|
* });
|
|
450
350
|
* ```
|
|
451
351
|
*/
|
|
452
|
-
public get align() {
|
|
453
|
-
return this._align;
|
|
454
|
-
}
|
|
455
|
-
|
|
352
|
+
public get align() { return this._align; }
|
|
456
353
|
/**
|
|
457
354
|
* Index of the panel to move when Flicking's {@link Flicking#init init()} is called. A zero-based integer
|
|
458
355
|
* @ko Flicking의 {@link Flicking#init init()}이 호출될 때 이동할 디폴트 패널의 인덱스로, 0부터 시작하는 정수입니다.
|
|
@@ -460,10 +357,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
460
357
|
* @default 0
|
|
461
358
|
* @see {@link https://naver.github.io/egjs-flicking/Options#defaultindex defaultIndex ( Options )}
|
|
462
359
|
*/
|
|
463
|
-
public get defaultIndex() {
|
|
464
|
-
return this._defaultIndex;
|
|
465
|
-
}
|
|
466
|
-
|
|
360
|
+
public get defaultIndex() { return this._defaultIndex; }
|
|
467
361
|
/**
|
|
468
362
|
* Direction of panel movement (true: horizontal, false: vertical)
|
|
469
363
|
* @ko 패널 이동 방향 (true: 가로방향, false: 세로방향)
|
|
@@ -471,10 +365,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
471
365
|
* @default true
|
|
472
366
|
* @see {@link https://naver.github.io/egjs-flicking/Options#horizontal horizontal ( Options )}
|
|
473
367
|
*/
|
|
474
|
-
public get horizontal() {
|
|
475
|
-
return this._horizontal;
|
|
476
|
-
}
|
|
477
|
-
|
|
368
|
+
public get horizontal() { return this._horizontal; }
|
|
478
369
|
/**
|
|
479
370
|
* Enables circular(continuous loop) mode, which connects first/last panel for continuous scrolling.
|
|
480
371
|
* @ko 순환 모드를 활성화합니다. 순환 모드에서는 양 끝의 패널이 서로 연결되어 끊김없는 스크롤이 가능합니다.
|
|
@@ -482,10 +373,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
482
373
|
* @default false
|
|
483
374
|
* @see {@link https://naver.github.io/egjs-flicking/Options#circular circular ( Options )}
|
|
484
375
|
*/
|
|
485
|
-
public get circular() {
|
|
486
|
-
return this._circular;
|
|
487
|
-
}
|
|
488
|
-
|
|
376
|
+
public get circular() { return this._circular; }
|
|
489
377
|
/**
|
|
490
378
|
* Set panel control mode for the case when circular cannot be enabled.
|
|
491
379
|
* "linear" will set the view's range from the top of the first panel to the top of the last panel.
|
|
@@ -498,10 +386,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
498
386
|
* @default "linear"
|
|
499
387
|
* @see {@link https://naver.github.io/egjs-flicking/Options#circularfallback circularFallback ( Options )}
|
|
500
388
|
*/
|
|
501
|
-
public get circularFallback() {
|
|
502
|
-
return this._circularFallback;
|
|
503
|
-
}
|
|
504
|
-
|
|
389
|
+
public get circularFallback() { return this._circularFallback; }
|
|
505
390
|
/**
|
|
506
391
|
* Prevent the view(camera element) from going out of the first/last panel, so it won't show empty spaces before/after the first/last panel
|
|
507
392
|
* Only can be enabled when `circular=false`
|
|
@@ -511,10 +396,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
511
396
|
* @default false
|
|
512
397
|
* @see {@link https://naver.github.io/egjs-flicking/Options#bound bound ( Options )}
|
|
513
398
|
*/
|
|
514
|
-
public get bound() {
|
|
515
|
-
return this._bound;
|
|
516
|
-
}
|
|
517
|
-
|
|
399
|
+
public get bound() { return this._bound; }
|
|
518
400
|
/**
|
|
519
401
|
* Update height of the viewport element after movement same to the height of the panel below. This can be only enabled when `horizontal=true`
|
|
520
402
|
* @ko 이동한 후 뷰포트 엘리먼트의 크기를 현재 패널의 높이와 동일하게 설정합니다. `horizontal=true`인 경우에만 사용할 수 있습니다.
|
|
@@ -522,10 +404,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
522
404
|
* @default false
|
|
523
405
|
* @see {@link https://naver.github.io/egjs-flicking/Options#adaptive adaptive ( Options )}
|
|
524
406
|
*/
|
|
525
|
-
public get adaptive() {
|
|
526
|
-
return this._adaptive;
|
|
527
|
-
}
|
|
528
|
-
|
|
407
|
+
public get adaptive() { return this._adaptive; }
|
|
529
408
|
/**
|
|
530
409
|
* A visible number of panels on viewport. Enabling this option will automatically resize panel size
|
|
531
410
|
* @ko 한 화면에 보이는 패널의 개수. 이 옵션을 활성화할 경우 패널의 크기를 강제로 재조정합니다
|
|
@@ -533,10 +412,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
533
412
|
* @default -1
|
|
534
413
|
* @see {@link https://naver.github.io/egjs-flicking/Options#panelsperview panelsPerView ( Options )}
|
|
535
414
|
*/
|
|
536
|
-
public get panelsPerView() {
|
|
537
|
-
return this._panelsPerView;
|
|
538
|
-
}
|
|
539
|
-
|
|
415
|
+
public get panelsPerView() { return this._panelsPerView; }
|
|
540
416
|
/**
|
|
541
417
|
* Enabling this option will not change `width/height` style of the panels if {@link Flicking#panelsPerView} is enabled.
|
|
542
418
|
* This behavior can be useful in terms of performance when you're manually managing all panel sizes
|
|
@@ -545,10 +421,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
545
421
|
* @type {boolean}
|
|
546
422
|
* @default false
|
|
547
423
|
*/
|
|
548
|
-
public get noPanelStyleOverride() {
|
|
549
|
-
return this._noPanelStyleOverride;
|
|
550
|
-
}
|
|
551
|
-
|
|
424
|
+
public get noPanelStyleOverride() { return this._noPanelStyleOverride; }
|
|
552
425
|
/**
|
|
553
426
|
* Enabling this option will automatically call {@link Flicking#resize} when all image/video inside panels are loaded.
|
|
554
427
|
* This can be useful when you have contents inside Flicking that changes its size when it's loaded
|
|
@@ -558,10 +431,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
558
431
|
* @default false
|
|
559
432
|
* @see {@link https://naver.github.io/egjs-flicking/Options#resizeOnContentsReady resizeOnContentsReady ( Options )}
|
|
560
433
|
*/
|
|
561
|
-
public get resizeOnContentsReady() {
|
|
562
|
-
return this._resizeOnContentsReady;
|
|
563
|
-
}
|
|
564
|
-
|
|
434
|
+
public get resizeOnContentsReady() { return this._resizeOnContentsReady; }
|
|
565
435
|
/**
|
|
566
436
|
* If you enable this option on child Flicking when the Flicking is placed inside the Flicking, the parent Flicking will move in the same direction after the child Flicking reaches the first/last panel.
|
|
567
437
|
* If the parent Flicking and child Flicking have different horizontal option, you do not need to set this option.
|
|
@@ -571,10 +441,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
571
441
|
* @default false
|
|
572
442
|
* @see {@link https://naver.github.io/egjs-flicking/Options#nested nested ( Options )}
|
|
573
443
|
*/
|
|
574
|
-
public get nested() {
|
|
575
|
-
return this._nested;
|
|
576
|
-
}
|
|
577
|
-
|
|
444
|
+
public get nested() { return this._nested; }
|
|
578
445
|
// EVENTS
|
|
579
446
|
/**
|
|
580
447
|
* A Threshold from viewport edge before triggering `needPanel` event
|
|
@@ -583,10 +450,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
583
450
|
* @default 0
|
|
584
451
|
* @see {@link https://naver.github.io/egjs-flicking/Options#needpanelthreshold needPanelThreshold ( Options )}
|
|
585
452
|
*/
|
|
586
|
-
public get needPanelThreshold() {
|
|
587
|
-
return this._needPanelThreshold;
|
|
588
|
-
}
|
|
589
|
-
|
|
453
|
+
public get needPanelThreshold() { return this._needPanelThreshold; }
|
|
590
454
|
/**
|
|
591
455
|
* When enabled, events are not triggered before `ready` when initializing
|
|
592
456
|
* @ko 활성화할 경우 초기화시 `ready` 이벤트 이전의 이벤트가 발생하지 않습니다.
|
|
@@ -594,10 +458,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
594
458
|
* @default true
|
|
595
459
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventeventsbeforeinit preventEventsBeforeInit ( Options )}
|
|
596
460
|
*/
|
|
597
|
-
public get preventEventsBeforeInit() {
|
|
598
|
-
return this._preventEventsBeforeInit;
|
|
599
|
-
}
|
|
600
|
-
|
|
461
|
+
public get preventEventsBeforeInit() { return this._preventEventsBeforeInit; }
|
|
601
462
|
// ANIMATION
|
|
602
463
|
/**
|
|
603
464
|
* Deceleration value for panel movement animation which is triggered by user input. A higher value means a shorter animation time
|
|
@@ -606,10 +467,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
606
467
|
* @default 0.0075
|
|
607
468
|
* @see {@link https://naver.github.io/egjs-flicking/Options#deceleration deceleration ( Options )}
|
|
608
469
|
*/
|
|
609
|
-
public get deceleration() {
|
|
610
|
-
return this._deceleration;
|
|
611
|
-
}
|
|
612
|
-
|
|
470
|
+
public get deceleration() { return this._deceleration; }
|
|
613
471
|
/**
|
|
614
472
|
* An easing function applied to the panel movement animation. Default value is `easeOutCubic`
|
|
615
473
|
* @ko 패널 이동 애니메이션에 적용할 easing 함수. 기본값은 `easeOutCubic`이다
|
|
@@ -618,10 +476,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
618
476
|
* @see Easing Functions Cheat Sheet {@link http://easings.net/} <ko>이징 함수 Cheat Sheet {@link http://easings.net/}</ko>
|
|
619
477
|
* @see {@link https://naver.github.io/egjs-flicking/Options#easing Easing ( Options )}
|
|
620
478
|
*/
|
|
621
|
-
public get easing() {
|
|
622
|
-
return this._easing;
|
|
623
|
-
}
|
|
624
|
-
|
|
479
|
+
public get easing() { return this._easing; }
|
|
625
480
|
/**
|
|
626
481
|
* Default duration of the animation (ms)
|
|
627
482
|
* @ko 디폴트 애니메이션 재생 시간 (ms)
|
|
@@ -629,10 +484,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
629
484
|
* @default 500
|
|
630
485
|
* @see {@link https://naver.github.io/egjs-flicking/Options#duration duration ( Options )}
|
|
631
486
|
*/
|
|
632
|
-
public get duration() {
|
|
633
|
-
return this._duration;
|
|
634
|
-
}
|
|
635
|
-
|
|
487
|
+
public get duration() { return this._duration; }
|
|
636
488
|
// INPUT
|
|
637
489
|
/**
|
|
638
490
|
* Types of input devices to enable
|
|
@@ -643,10 +495,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
643
495
|
* <ko>{@link https://naver.github.io/egjs-axes/Options#paninput-options 가능한 값들 (PanInputOption#inputType)}</ko>
|
|
644
496
|
* @see {@link https://naver.github.io/egjs-flicking/Options#inputtype inputType ( Options )}
|
|
645
497
|
*/
|
|
646
|
-
public get inputType() {
|
|
647
|
-
return this._inputType;
|
|
648
|
-
}
|
|
649
|
-
|
|
498
|
+
public get inputType() { return this._inputType; }
|
|
650
499
|
/**
|
|
651
500
|
* Movement style by user input. This will change instance type of {@link Flicking#control}
|
|
652
501
|
* You can use the values of the constant {@link MOVE_TYPE}
|
|
@@ -678,10 +527,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
678
527
|
* });
|
|
679
528
|
* ```
|
|
680
529
|
*/
|
|
681
|
-
public get moveType() {
|
|
682
|
-
return this._moveType;
|
|
683
|
-
}
|
|
684
|
-
|
|
530
|
+
public get moveType() { return this._moveType; }
|
|
685
531
|
/**
|
|
686
532
|
* Movement threshold to change panel (unit: px). It should be dragged above the threshold to change the current panel.
|
|
687
533
|
* @ko 패널 변경을 위한 이동 임계값 (단위: px). 주어진 값 이상으로 스크롤해야만 패널 변경이 가능합니다.
|
|
@@ -689,10 +535,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
689
535
|
* @default 40
|
|
690
536
|
* @see {@link https://naver.github.io/egjs-flicking/Options#threshold Threshold ( Options )}
|
|
691
537
|
*/
|
|
692
|
-
public get threshold() {
|
|
693
|
-
return this._threshold;
|
|
694
|
-
}
|
|
695
|
-
|
|
538
|
+
public get threshold() { return this._threshold; }
|
|
696
539
|
/**
|
|
697
540
|
* Minimal distance of user input before recognizing (unit: px). It should be dragged above the dragThreshold to move the panel.
|
|
698
541
|
* @ko 사용자의 입력을 인식하기 위한 최소한의 거리 (단위: px). 주어진 값 이상으로 스크롤해야만 패널이 움직입니다.
|
|
@@ -700,10 +543,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
700
543
|
* @default 1
|
|
701
544
|
* @see {@link https://naver.github.io/egjs-flicking/Options#dragThreshold dragThreshold ( Options )}
|
|
702
545
|
*/
|
|
703
|
-
public get dragThreshold() {
|
|
704
|
-
return this._dragThreshold;
|
|
705
|
-
}
|
|
706
|
-
|
|
546
|
+
public get dragThreshold() { return this._dragThreshold; }
|
|
707
547
|
/**
|
|
708
548
|
* Set animation to be interruptable by click/touch.
|
|
709
549
|
* @ko 사용자의 클릭/터치로 인해 애니메이션을 도중에 멈출 수 있도록 설정합니다.
|
|
@@ -711,10 +551,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
711
551
|
* @default true
|
|
712
552
|
* @see {@link https://naver.github.io/egjs-flicking/Options#interruptable Interruptable ( Options )}
|
|
713
553
|
*/
|
|
714
|
-
public get interruptable() {
|
|
715
|
-
return this._interruptable;
|
|
716
|
-
}
|
|
717
|
-
|
|
554
|
+
public get interruptable() { return this._interruptable; }
|
|
718
555
|
/**
|
|
719
556
|
* The size value of the bounce area. Only can be enabled when `circular=false`.
|
|
720
557
|
* You can set different bounce value for prev/next direction by using array.
|
|
@@ -747,10 +584,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
747
584
|
* flicking.control.updateInput(); // Call this to update!
|
|
748
585
|
* ```
|
|
749
586
|
*/
|
|
750
|
-
public get bounce() {
|
|
751
|
-
return this._bounce;
|
|
752
|
-
}
|
|
753
|
-
|
|
587
|
+
public get bounce() { return this._bounce; }
|
|
754
588
|
/**
|
|
755
589
|
* Size of the area from the right edge in iOS safari (in px) which enables swipe-back or swipe-forward
|
|
756
590
|
* @ko iOS Safari에서 swipe를 통한 뒤로가기/앞으로가기를 활성화하는 오른쪽 끝으로부터의 영역의 크기 (px)
|
|
@@ -758,10 +592,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
758
592
|
* @default 30
|
|
759
593
|
* @see {@link https://naver.github.io/egjs-flicking/Options#iosedgeswipethreshold iOSEdgeSwipeThreshold ( Options )}
|
|
760
594
|
*/
|
|
761
|
-
public get iOSEdgeSwipeThreshold() {
|
|
762
|
-
return this._iOSEdgeSwipeThreshold;
|
|
763
|
-
}
|
|
764
|
-
|
|
595
|
+
public get iOSEdgeSwipeThreshold() { return this._iOSEdgeSwipeThreshold; }
|
|
765
596
|
/**
|
|
766
597
|
* Automatically prevent `click` event if the user has dragged at least a single pixel on the viewport element
|
|
767
598
|
* @ko 사용자가 뷰포트 영역을 1픽셀이라도 드래그했을 경우 자동으로 {@link https://developer.mozilla.org/ko/docs/Web/API/Element/click_event click} 이벤트를 취소합니다
|
|
@@ -769,10 +600,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
769
600
|
* @default true
|
|
770
601
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventclickondrag preventClickOnDrag ( Options )}
|
|
771
602
|
*/
|
|
772
|
-
public get preventClickOnDrag() {
|
|
773
|
-
return this._preventClickOnDrag;
|
|
774
|
-
}
|
|
775
|
-
|
|
603
|
+
public get preventClickOnDrag() { return this._preventClickOnDrag; }
|
|
776
604
|
/**
|
|
777
605
|
* Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} when the user starts dragging
|
|
778
606
|
* @ko 사용자가 드래그를 시작할 때 {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} 실행 여부
|
|
@@ -780,10 +608,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
780
608
|
* @default false
|
|
781
609
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventDefaultOnDrag preventDefaultOnDrag ( Options )}
|
|
782
610
|
*/
|
|
783
|
-
public get preventDefaultOnDrag() {
|
|
784
|
-
return this._preventDefaultOnDrag;
|
|
785
|
-
}
|
|
786
|
-
|
|
611
|
+
public get preventDefaultOnDrag() { return this._preventDefaultOnDrag; }
|
|
787
612
|
/**
|
|
788
613
|
* Automatically call {@link Flicking#disableInput disableInput()} on initialization
|
|
789
614
|
* @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다
|
|
@@ -791,10 +616,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
791
616
|
* @default false
|
|
792
617
|
* @see {@link https://naver.github.io/egjs-flicking/Options#disableoninit disableOnInit ( Options )}
|
|
793
618
|
*/
|
|
794
|
-
public get disableOnInit() {
|
|
795
|
-
return this._disableOnInit;
|
|
796
|
-
}
|
|
797
|
-
|
|
619
|
+
public get disableOnInit() { return this._disableOnInit; }
|
|
798
620
|
/**
|
|
799
621
|
* Change active panel index on mouse/touch hold while animating.
|
|
800
622
|
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
@@ -804,10 +626,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
804
626
|
* @default false
|
|
805
627
|
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
806
628
|
*/
|
|
807
|
-
public get changeOnHold() {
|
|
808
|
-
return this._changeOnHold;
|
|
809
|
-
}
|
|
810
|
-
|
|
629
|
+
public get changeOnHold() { return this._changeOnHold; }
|
|
811
630
|
// PERFORMANCE
|
|
812
631
|
/**
|
|
813
632
|
* Whether to render visible panels only. This can dramatically increase performance when there're many panels
|
|
@@ -816,10 +635,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
816
635
|
* @default false
|
|
817
636
|
* @see {@link https://naver.github.io/egjs-flicking/Options#renderonlyvisible renderOnlyVisible ( Options )}
|
|
818
637
|
*/
|
|
819
|
-
public get renderOnlyVisible() {
|
|
820
|
-
return this._renderOnlyVisible;
|
|
821
|
-
}
|
|
822
|
-
|
|
638
|
+
public get renderOnlyVisible() { return this._renderOnlyVisible; }
|
|
823
639
|
/**
|
|
824
640
|
* By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
|
|
825
641
|
* Must be used with `panelsPerview`.
|
|
@@ -852,9 +668,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
852
668
|
* flicking.virtual.remove(0, 100);
|
|
853
669
|
* ```
|
|
854
670
|
*/
|
|
855
|
-
public get virtual() {
|
|
856
|
-
return this._virtualManager;
|
|
857
|
-
}
|
|
671
|
+
public get virtual() { return this._virtualManager; }
|
|
858
672
|
|
|
859
673
|
// OTHERS
|
|
860
674
|
/**
|
|
@@ -865,20 +679,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
865
679
|
* @see {@link https://naver.github.io/egjs-flicking/Options#autoinit autoInit ( Options )}
|
|
866
680
|
* @readonly
|
|
867
681
|
*/
|
|
868
|
-
public get autoInit() {
|
|
869
|
-
return this._autoInit;
|
|
870
|
-
}
|
|
871
|
-
|
|
682
|
+
public get autoInit() { return this._autoInit; }
|
|
872
683
|
/**
|
|
873
684
|
* Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
|
|
874
685
|
* @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
|
|
875
686
|
* @type {boolean}
|
|
876
687
|
* @default true
|
|
877
688
|
*/
|
|
878
|
-
public get autoResize() {
|
|
879
|
-
return this._autoResize;
|
|
880
|
-
}
|
|
881
|
-
|
|
689
|
+
public get autoResize() { return this._autoResize; }
|
|
882
690
|
/**
|
|
883
691
|
* Whether to listen {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}'s event instead of Window's {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} event when using the `autoResize` option
|
|
884
692
|
* @ko autoResize 옵션 사용시 {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}의 이벤트를 Window객체의 {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} 이벤트 대신 수신할지 여부를 설정합니다
|
|
@@ -887,15 +695,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
887
695
|
* @see {@link https://naver.github.io/egjs-flicking/Options#useresizeobserver useResizeObserver ( Options )}
|
|
888
696
|
*/
|
|
889
697
|
public get useResizeObserver() { return this._useResizeObserver; }
|
|
890
|
-
/**
|
|
891
|
-
* Whether to use {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver} to observe the size of the panel element
|
|
892
|
-
* This is only available when `useResizeObserver` is enabled.
|
|
893
|
-
* This option garantees that the resize event is triggered when the size of the panel element is changed.
|
|
894
|
-
* @ko 이 옵션을 활성화할 경우, {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}를 사용하여 패널 엘리먼트의 크기를 추적합니다.
|
|
895
|
-
* 이 옵션은 `useResizeObserver` 옵션이 활성화된 경우에만 사용할 수 있습니다.
|
|
896
|
-
* 이 옵션은 패널 엘리먼트의 크기가 변경될 경우 resize 이벤트가 발생하도록 보장합니다.
|
|
897
|
-
*/
|
|
898
|
-
public get observePanelResize() { return this._observePanelResize; }
|
|
899
698
|
/**
|
|
900
699
|
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
901
700
|
* If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
|
|
@@ -907,10 +706,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
907
706
|
* @default 0
|
|
908
707
|
* @see {@link https://naver.github.io/egjs-flicking/Options#resizedebounce resizeDebounce ( Options )}
|
|
909
708
|
*/
|
|
910
|
-
public get resizeDebounce() {
|
|
911
|
-
return this._resizeDebounce;
|
|
912
|
-
}
|
|
913
|
-
|
|
709
|
+
public get resizeDebounce() { return this._resizeDebounce; }
|
|
914
710
|
/**
|
|
915
711
|
* The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
|
|
916
712
|
* This guarantees that size recalculation is performed at least once every (n)ms.
|
|
@@ -920,10 +716,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
920
716
|
* @default 100
|
|
921
717
|
* @see {@link https://naver.github.io/egjs-flicking/Options#maxresizedebounce maxResizeDebounce ( Options )}
|
|
922
718
|
*/
|
|
923
|
-
public get maxResizeDebounce() {
|
|
924
|
-
return this._maxResizeDebounce;
|
|
925
|
-
}
|
|
926
|
-
|
|
719
|
+
public get maxResizeDebounce() { return this._maxResizeDebounce; }
|
|
927
720
|
/**
|
|
928
721
|
* By enabling this, Flicking will calculate all internal size with CSS width computed with getComputedStyle.
|
|
929
722
|
* This can prevent 1px offset issue in some cases where panel size has the fractional part.
|
|
@@ -935,10 +728,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
935
728
|
* @default false
|
|
936
729
|
* @see {@link https://naver.github.io/egjs-flicking/Options#usefractionalsize useFractionalSize ( Options )}
|
|
937
730
|
*/
|
|
938
|
-
public get useFractionalSize() {
|
|
939
|
-
return this._useFractionalSize;
|
|
940
|
-
}
|
|
941
|
-
|
|
731
|
+
public get useFractionalSize() { return this._useFractionalSize; }
|
|
942
732
|
/**
|
|
943
733
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
944
734
|
* @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
|
|
@@ -946,10 +736,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
946
736
|
* @internal
|
|
947
737
|
* @readonly
|
|
948
738
|
*/
|
|
949
|
-
public get externalRenderer() {
|
|
950
|
-
return this._externalRenderer;
|
|
951
|
-
}
|
|
952
|
-
|
|
739
|
+
public get externalRenderer() { return this._externalRenderer; }
|
|
953
740
|
/**
|
|
954
741
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
955
742
|
* @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
|
|
@@ -958,27 +745,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
958
745
|
* @readonly
|
|
959
746
|
* @deprecated
|
|
960
747
|
*/
|
|
961
|
-
public get renderExternal() {
|
|
962
|
-
return this._renderExternal;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
/**
|
|
966
|
-
* This option works only when autoResize is set to true.
|
|
967
|
-
* By default, autoResize listens to changes in both the viewport's width and height, updating all panel sizes accordingly.
|
|
968
|
-
* When optimizeSizeUpdate is enabled, the update behavior is optimized based on the flicking direction:
|
|
969
|
-
* If direction is "horizontal", only changes in width will trigger panel size updates.
|
|
970
|
-
* If direction is "vertical", only changes in height will do so.
|
|
971
|
-
* This option is useful when panel heights vary and unwanted flickering occurs due to frequent size recalculations during flicking. Enabling optimizeSizeUpdate prevents unnecessary updates and helps maintain visual stability.
|
|
972
|
-
* @ko optimizeSizeUpdate는 autoResize가 true일 때만 동작합니다.
|
|
973
|
-
* 기본적으로 autoResize는 뷰포트의 width와 height 변화를 모두 감지하여 패널들의 사이즈를 업데이트합니다.
|
|
974
|
-
* 이 옵션을 활성화하면 플리킹 방향에 따라 필요한 차원(horizontal → width, vertical → height)에 대해서만 사이즈를 업데이트합니다.
|
|
975
|
-
* 내부 패널의 높이가 서로 다를 때, 플리킹 중 과도한 리사이징으로 인한 깜빡임 현상을 줄이는 데 유용합니다.
|
|
976
|
-
* @type {boolean}
|
|
977
|
-
* @default false
|
|
978
|
-
*/
|
|
979
|
-
public get optimizeSizeUpdate() {
|
|
980
|
-
return this._optimizeSizeUpdate;
|
|
981
|
-
}
|
|
748
|
+
public get renderExternal() { return this._renderExternal; }
|
|
982
749
|
|
|
983
750
|
// Options Setter
|
|
984
751
|
// UI / LAYOUT
|
|
@@ -989,10 +756,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
989
756
|
void this.resize();
|
|
990
757
|
}
|
|
991
758
|
|
|
992
|
-
public set defaultIndex(val: FlickingOptions["defaultIndex"]) {
|
|
993
|
-
this._defaultIndex = val;
|
|
994
|
-
}
|
|
995
|
-
|
|
759
|
+
public set defaultIndex(val: FlickingOptions["defaultIndex"]) { this._defaultIndex = val; }
|
|
996
760
|
public set horizontal(val: FlickingOptions["horizontal"]) {
|
|
997
761
|
this._horizontal = val;
|
|
998
762
|
this._control.controller.updateDirection();
|
|
@@ -1019,16 +783,12 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1019
783
|
void this.resize();
|
|
1020
784
|
}
|
|
1021
785
|
|
|
1022
|
-
public set noPanelStyleOverride(
|
|
1023
|
-
val: FlickingOptions["noPanelStyleOverride"]
|
|
1024
|
-
) {
|
|
786
|
+
public set noPanelStyleOverride(val: FlickingOptions["noPanelStyleOverride"]) {
|
|
1025
787
|
this._noPanelStyleOverride = val;
|
|
1026
788
|
void this.resize();
|
|
1027
789
|
}
|
|
1028
790
|
|
|
1029
|
-
public set resizeOnContentsReady(
|
|
1030
|
-
val: FlickingOptions["resizeOnContentsReady"]
|
|
1031
|
-
) {
|
|
791
|
+
public set resizeOnContentsReady(val: FlickingOptions["resizeOnContentsReady"]) {
|
|
1032
792
|
this._resizeOnContentsReady = val;
|
|
1033
793
|
if (val) {
|
|
1034
794
|
this._renderer.checkPanelContentsReady(this._renderer.panels);
|
|
@@ -1045,16 +805,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1045
805
|
}
|
|
1046
806
|
|
|
1047
807
|
// EVENTS
|
|
1048
|
-
public set needPanelThreshold(val: FlickingOptions["needPanelThreshold"]) {
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
public set preventEventsBeforeInit(
|
|
1053
|
-
val: FlickingOptions["preventEventsBeforeInit"]
|
|
1054
|
-
) {
|
|
1055
|
-
this._preventEventsBeforeInit = val;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
808
|
+
public set needPanelThreshold(val: FlickingOptions["needPanelThreshold"]) { this._needPanelThreshold = val; }
|
|
809
|
+
public set preventEventsBeforeInit(val: FlickingOptions["preventEventsBeforeInit"]) { this._preventEventsBeforeInit = val; }
|
|
1058
810
|
// ANIMATION
|
|
1059
811
|
public set deceleration(val: FlickingOptions["deceleration"]) {
|
|
1060
812
|
this._deceleration = val;
|
|
@@ -1074,10 +826,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1074
826
|
}
|
|
1075
827
|
}
|
|
1076
828
|
|
|
1077
|
-
public set duration(val: FlickingOptions["duration"]) {
|
|
1078
|
-
this._duration = val;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
829
|
+
public set duration(val: FlickingOptions["duration"]) { this._duration = val; }
|
|
1081
830
|
// INPUT
|
|
1082
831
|
public set inputType(val: FlickingOptions["inputType"]) {
|
|
1083
832
|
this._inputType = val;
|
|
@@ -1105,9 +854,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1105
854
|
this._control.updateInput();
|
|
1106
855
|
}
|
|
1107
856
|
|
|
1108
|
-
public set threshold(val: FlickingOptions["threshold"]) {
|
|
1109
|
-
this._threshold = val;
|
|
1110
|
-
}
|
|
857
|
+
public set threshold(val: FlickingOptions["threshold"]) { this._threshold = val; }
|
|
1111
858
|
|
|
1112
859
|
public set dragThreshold(val: FlickingOptions["dragThreshold"]) {
|
|
1113
860
|
this._dragThreshold = val;
|
|
@@ -1133,9 +880,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1133
880
|
this._control.updateInput();
|
|
1134
881
|
}
|
|
1135
882
|
|
|
1136
|
-
public set iOSEdgeSwipeThreshold(
|
|
1137
|
-
val: FlickingOptions["iOSEdgeSwipeThreshold"]
|
|
1138
|
-
) {
|
|
883
|
+
public set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]) {
|
|
1139
884
|
this._iOSEdgeSwipeThreshold = val;
|
|
1140
885
|
const panInput = this._control.controller.panInput;
|
|
1141
886
|
|
|
@@ -1160,9 +905,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1160
905
|
this._preventClickOnDrag = val;
|
|
1161
906
|
}
|
|
1162
907
|
|
|
1163
|
-
public set preventDefaultOnDrag(
|
|
1164
|
-
val: FlickingOptions["preventDefaultOnDrag"]
|
|
1165
|
-
) {
|
|
908
|
+
public set preventDefaultOnDrag(val: FlickingOptions["preventDefaultOnDrag"]) {
|
|
1166
909
|
this._preventDefaultOnDrag = val;
|
|
1167
910
|
const panInput = this._control.controller.panInput;
|
|
1168
911
|
|
|
@@ -1171,14 +914,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1171
914
|
}
|
|
1172
915
|
}
|
|
1173
916
|
|
|
1174
|
-
public set disableOnInit(val: FlickingOptions["disableOnInit"]) {
|
|
1175
|
-
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
public set changeOnHold(val: FlickingOptions["changeOnHold"]) {
|
|
1179
|
-
this._changeOnHold = val;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
917
|
+
public set disableOnInit(val: FlickingOptions["disableOnInit"]) { this._disableOnInit = val; }
|
|
918
|
+
public set changeOnHold(val: FlickingOptions["changeOnHold"]) { this._changeOnHold = val; }
|
|
1182
919
|
// PERFORMANCE
|
|
1183
920
|
public set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]) {
|
|
1184
921
|
this._renderOnlyVisible = val;
|
|
@@ -1189,10 +926,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1189
926
|
public set autoResize(val: FlickingOptions["autoResize"]) {
|
|
1190
927
|
this._autoResize = val;
|
|
1191
928
|
|
|
1192
|
-
if (!this._initialized) {
|
|
1193
|
-
return;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
929
|
if (val) {
|
|
1197
930
|
this._autoResizer.enable();
|
|
1198
931
|
} else {
|
|
@@ -1203,27 +936,11 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1203
936
|
public set useResizeObserver(val: FlickingOptions["useResizeObserver"]) {
|
|
1204
937
|
this._useResizeObserver = val;
|
|
1205
938
|
|
|
1206
|
-
if (this.
|
|
939
|
+
if (this._autoResize) {
|
|
1207
940
|
this._autoResizer.enable();
|
|
1208
941
|
}
|
|
1209
942
|
}
|
|
1210
943
|
|
|
1211
|
-
public set observePanelResize(val: FlickingOptions["observePanelResize"]) {
|
|
1212
|
-
this._observePanelResize = val;
|
|
1213
|
-
|
|
1214
|
-
if (this._initialized && this._autoResize) {
|
|
1215
|
-
if (val) {
|
|
1216
|
-
this._autoResizer.observePanels();
|
|
1217
|
-
} else {
|
|
1218
|
-
this._autoResizer.unobservePanels();
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
public set optimizeSizeUpdate(val: FlickingOptions["optimizeSizeUpdate"]) {
|
|
1224
|
-
this._optimizeSizeUpdate = val;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
944
|
/**
|
|
1228
945
|
* @param root A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
|
|
1229
946
|
* <ko>Flicking을 초기화할 HTMLElement로, `string` 타입으로 지정시 css 선택자 문자열을 지정해야 합니다.</ko>
|
|
@@ -1286,19 +1003,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1286
1003
|
autoResize = true,
|
|
1287
1004
|
useResizeObserver = true,
|
|
1288
1005
|
resizeDebounce = 0,
|
|
1289
|
-
observePanelResize = false,
|
|
1290
1006
|
maxResizeDebounce = 100,
|
|
1291
1007
|
useFractionalSize = false,
|
|
1292
1008
|
externalRenderer = null,
|
|
1293
|
-
renderExternal = null
|
|
1294
|
-
optimizeSizeUpdate = false
|
|
1009
|
+
renderExternal = null
|
|
1295
1010
|
}: Partial<FlickingOptions> = {}) {
|
|
1296
1011
|
super();
|
|
1297
1012
|
|
|
1298
1013
|
// Internal states
|
|
1299
1014
|
this._initialized = false;
|
|
1300
1015
|
this._plugins = [];
|
|
1301
|
-
this._isResizing = false;
|
|
1302
1016
|
|
|
1303
1017
|
// Bind options
|
|
1304
1018
|
this._align = align;
|
|
@@ -1335,11 +1049,9 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1335
1049
|
this._useResizeObserver = useResizeObserver;
|
|
1336
1050
|
this._resizeDebounce = resizeDebounce;
|
|
1337
1051
|
this._maxResizeDebounce = maxResizeDebounce;
|
|
1338
|
-
this._observePanelResize = observePanelResize;
|
|
1339
1052
|
this._useFractionalSize = useFractionalSize;
|
|
1340
1053
|
this._externalRenderer = externalRenderer;
|
|
1341
1054
|
this._renderExternal = renderExternal;
|
|
1342
|
-
this._optimizeSizeUpdate = optimizeSizeUpdate;
|
|
1343
1055
|
|
|
1344
1056
|
// Create core components
|
|
1345
1057
|
this._viewport = new Viewport(this, getElement(root));
|
|
@@ -1399,7 +1111,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1399
1111
|
|
|
1400
1112
|
return renderer.render().then(() => {
|
|
1401
1113
|
// Done initializing & emit ready event
|
|
1402
|
-
this._plugins.forEach(
|
|
1114
|
+
this._plugins.forEach(plugin => plugin.init(this));
|
|
1403
1115
|
|
|
1404
1116
|
if (preventEventsBeforeInit) {
|
|
1405
1117
|
this.trigger = originalTrigger;
|
|
@@ -1421,7 +1133,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1421
1133
|
this._camera.destroy();
|
|
1422
1134
|
this._renderer.destroy();
|
|
1423
1135
|
|
|
1424
|
-
this._plugins.forEach(
|
|
1136
|
+
this._plugins.forEach(plugin => plugin.destroy());
|
|
1425
1137
|
|
|
1426
1138
|
this._initialized = false;
|
|
1427
1139
|
}
|
|
@@ -1460,11 +1172,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1460
1172
|
* @return {Promise<void>} A Promise which will be resolved after reaching the previous panel<ko>이전 패널 도달시에 resolve되는 Promise</ko>
|
|
1461
1173
|
*/
|
|
1462
1174
|
public prev(duration: number = this._duration): Promise<void> {
|
|
1463
|
-
return this.moveTo(
|
|
1464
|
-
this._control.activePanel?.prev()?.index ?? -1,
|
|
1465
|
-
duration,
|
|
1466
|
-
DIRECTION.PREV
|
|
1467
|
-
);
|
|
1175
|
+
return this.moveTo(this._control.activePanel?.prev()?.index ?? -1, duration, DIRECTION.PREV);
|
|
1468
1176
|
}
|
|
1469
1177
|
|
|
1470
1178
|
/**
|
|
@@ -1502,11 +1210,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1502
1210
|
* @return {Promise<void>} A Promise which will be resolved after reaching the next panel<ko>다음 패널 도달시에 resolve되는 Promise</ko>
|
|
1503
1211
|
*/
|
|
1504
1212
|
public next(duration: number = this._duration) {
|
|
1505
|
-
return this.moveTo(
|
|
1506
|
-
this._control.activePanel?.next()?.index ?? this._renderer.panelCount,
|
|
1507
|
-
duration,
|
|
1508
|
-
DIRECTION.NEXT
|
|
1509
|
-
);
|
|
1213
|
+
return this.moveTo(this._control.activePanel?.next()?.index ?? this._renderer.panelCount, duration, DIRECTION.NEXT);
|
|
1510
1214
|
}
|
|
1511
1215
|
|
|
1512
1216
|
/**
|
|
@@ -1545,32 +1249,18 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1545
1249
|
* </ko>
|
|
1546
1250
|
* @return {Promise<void>} A Promise which will be resolved after reaching the target panel<ko>해당 패널 도달시에 resolve되는 Promise</ko>
|
|
1547
1251
|
*/
|
|
1548
|
-
public moveTo(
|
|
1549
|
-
index: number,
|
|
1550
|
-
duration: number = this._duration,
|
|
1551
|
-
direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE
|
|
1552
|
-
) {
|
|
1252
|
+
public moveTo(index: number, duration: number = this._duration, direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE) {
|
|
1553
1253
|
const renderer = this._renderer;
|
|
1554
1254
|
const panelCount = renderer.panelCount;
|
|
1555
1255
|
|
|
1556
1256
|
const panel = renderer.getPanel(index);
|
|
1557
1257
|
|
|
1558
1258
|
if (!panel) {
|
|
1559
|
-
return Promise.reject(
|
|
1560
|
-
new FlickingError(
|
|
1561
|
-
ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
|
|
1562
|
-
ERROR.CODE.INDEX_OUT_OF_RANGE
|
|
1563
|
-
)
|
|
1564
|
-
);
|
|
1259
|
+
return Promise.reject(new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE));
|
|
1565
1260
|
}
|
|
1566
1261
|
|
|
1567
1262
|
if (this._control.animating) {
|
|
1568
|
-
return Promise.reject(
|
|
1569
|
-
new FlickingError(
|
|
1570
|
-
ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING,
|
|
1571
|
-
ERROR.CODE.ANIMATION_ALREADY_PLAYING
|
|
1572
|
-
)
|
|
1573
|
-
);
|
|
1263
|
+
return Promise.reject(new FlickingError(ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING, ERROR.CODE.ANIMATION_ALREADY_PLAYING));
|
|
1574
1264
|
}
|
|
1575
1265
|
|
|
1576
1266
|
if (this._control.holding) {
|
|
@@ -1594,11 +1284,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1594
1284
|
* <ko>{@link ERROR_CODE INDEX_OUT_OF_RANGE} 해당 인덱스를 가진 패널이 존재하지 않을 경우</ko>
|
|
1595
1285
|
* @return {void}
|
|
1596
1286
|
*/
|
|
1597
|
-
public updateAnimation(
|
|
1598
|
-
index: number,
|
|
1599
|
-
duration?: number,
|
|
1600
|
-
direction?: ValueOf<typeof DIRECTION>
|
|
1601
|
-
): void {
|
|
1287
|
+
public updateAnimation(index: number, duration?: number, direction?: ValueOf<typeof DIRECTION>): void {
|
|
1602
1288
|
if (!this._control.animating) {
|
|
1603
1289
|
return;
|
|
1604
1290
|
}
|
|
@@ -1609,10 +1295,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1609
1295
|
const panel = renderer.getPanel(index);
|
|
1610
1296
|
|
|
1611
1297
|
if (!panel) {
|
|
1612
|
-
throw new FlickingError(
|
|
1613
|
-
ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
|
|
1614
|
-
ERROR.CODE.INDEX_OUT_OF_RANGE
|
|
1615
|
-
);
|
|
1298
|
+
throw new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE);
|
|
1616
1299
|
}
|
|
1617
1300
|
|
|
1618
1301
|
this._control.updateAnimation(panel, duration, direction);
|
|
@@ -1694,7 +1377,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1694
1377
|
const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
|
|
1695
1378
|
|
|
1696
1379
|
const status: Status = {
|
|
1697
|
-
panels: panels.map(
|
|
1380
|
+
panels: panels.map(panel => {
|
|
1698
1381
|
const panelInfo: Status["panels"][0] = { index: panel.index };
|
|
1699
1382
|
|
|
1700
1383
|
if (includePanelHTML) {
|
|
@@ -1717,6 +1400,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1717
1400
|
progressInPanel: camera.getProgressInPanel(nearestAnchor.panel)
|
|
1718
1401
|
};
|
|
1719
1402
|
}
|
|
1403
|
+
|
|
1720
1404
|
}
|
|
1721
1405
|
|
|
1722
1406
|
if (visiblePanelsOnly) {
|
|
@@ -1736,43 +1420,40 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1736
1420
|
*/
|
|
1737
1421
|
public setStatus(status: Status): void {
|
|
1738
1422
|
if (!this._initialized) {
|
|
1739
|
-
throw new FlickingError(
|
|
1740
|
-
ERROR.MESSAGE.NOT_INITIALIZED,
|
|
1741
|
-
ERROR.CODE.NOT_INITIALIZED
|
|
1742
|
-
);
|
|
1423
|
+
throw new FlickingError(ERROR.MESSAGE.NOT_INITIALIZED, ERROR.CODE.NOT_INITIALIZED);
|
|
1743
1424
|
}
|
|
1744
1425
|
|
|
1745
|
-
const {
|
|
1426
|
+
const {
|
|
1427
|
+
index,
|
|
1428
|
+
position,
|
|
1429
|
+
visibleOffset,
|
|
1430
|
+
panels
|
|
1431
|
+
} = status;
|
|
1746
1432
|
|
|
1747
1433
|
const renderer = this._renderer;
|
|
1748
1434
|
const control = this._control;
|
|
1749
1435
|
|
|
1750
1436
|
// Can't add/remove panels on external rendering
|
|
1751
1437
|
if (panels[0]?.html && !this._renderExternal) {
|
|
1752
|
-
renderer.batchRemove({
|
|
1753
|
-
|
|
1754
|
-
deleteCount: this.panels.length,
|
|
1755
|
-
hasDOMInElements: true
|
|
1756
|
-
});
|
|
1757
|
-
renderer.batchInsert({
|
|
1758
|
-
index: 0,
|
|
1759
|
-
elements: parseElement(panels.map((panel) => panel.html!)),
|
|
1760
|
-
hasDOMInElements: true
|
|
1761
|
-
});
|
|
1438
|
+
renderer.batchRemove({ index: 0, deleteCount: this.panels.length, hasDOMInElements: true });
|
|
1439
|
+
renderer.batchInsert({ index: 0, elements: parseElement(panels.map(panel => panel.html!)), hasDOMInElements: true });
|
|
1762
1440
|
}
|
|
1763
1441
|
|
|
1764
1442
|
if (index != null) {
|
|
1765
|
-
const panelIndex = visibleOffset
|
|
1443
|
+
const panelIndex = visibleOffset
|
|
1444
|
+
? index - visibleOffset
|
|
1445
|
+
: index;
|
|
1766
1446
|
|
|
1767
1447
|
void this.moveTo(panelIndex, 0).catch(() => void 0);
|
|
1768
1448
|
}
|
|
1769
1449
|
|
|
1770
1450
|
if (position && this._moveType === MOVE_TYPE.FREE_SCROLL) {
|
|
1771
1451
|
const { panel, progressInPanel } = position;
|
|
1772
|
-
const panelIndex = visibleOffset
|
|
1452
|
+
const panelIndex = visibleOffset
|
|
1453
|
+
? panel - visibleOffset
|
|
1454
|
+
: panel;
|
|
1773
1455
|
const panelRange = renderer.panels[panelIndex].range;
|
|
1774
|
-
const newCameraPos =
|
|
1775
|
-
panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
|
|
1456
|
+
const newCameraPos = panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
|
|
1776
1457
|
|
|
1777
1458
|
void control.moveToPosition(newCameraPos, 0).catch(() => void 0);
|
|
1778
1459
|
}
|
|
@@ -1787,7 +1468,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1787
1468
|
*/
|
|
1788
1469
|
public addPlugins(...plugins: Plugin[]) {
|
|
1789
1470
|
if (this._initialized) {
|
|
1790
|
-
plugins.forEach(
|
|
1471
|
+
plugins.forEach(item => item.init(this));
|
|
1791
1472
|
}
|
|
1792
1473
|
|
|
1793
1474
|
this._plugins.push(...plugins);
|
|
@@ -1803,8 +1484,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1803
1484
|
* @see https://github.com/naver/egjs-flicking-plugins
|
|
1804
1485
|
*/
|
|
1805
1486
|
public removePlugins(...plugins: Plugin[]) {
|
|
1806
|
-
plugins.forEach(
|
|
1807
|
-
const foundIndex = findIndex(this._plugins,
|
|
1487
|
+
plugins.forEach(item => {
|
|
1488
|
+
const foundIndex = findIndex(this._plugins, val => val === item);
|
|
1808
1489
|
|
|
1809
1490
|
if (foundIndex >= 0) {
|
|
1810
1491
|
item.destroy();
|
|
@@ -1824,10 +1505,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1824
1505
|
* @return {this}
|
|
1825
1506
|
*/
|
|
1826
1507
|
public async resize(): Promise<void> {
|
|
1827
|
-
if (this._isResizing) return;
|
|
1828
|
-
|
|
1829
|
-
this._isResizing = true;
|
|
1830
|
-
|
|
1831
1508
|
const viewport = this._viewport;
|
|
1832
1509
|
const renderer = this._renderer;
|
|
1833
1510
|
const camera = this._camera;
|
|
@@ -1840,27 +1517,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1840
1517
|
? camera.getProgressInPanel(activePanel)
|
|
1841
1518
|
: 0;
|
|
1842
1519
|
|
|
1843
|
-
this.trigger(
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
})
|
|
1849
|
-
);
|
|
1520
|
+
this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
1521
|
+
width: prevWidth,
|
|
1522
|
+
height: prevHeight,
|
|
1523
|
+
element: viewport.element
|
|
1524
|
+
}));
|
|
1850
1525
|
|
|
1851
1526
|
viewport.resize();
|
|
1852
|
-
|
|
1853
|
-
// 뷰포트 사이즈가 변경되었을 때 내부의 패널 사이즈들도 전부 업데이트 되어야 하므로 패널들을 전부 리렌더링한다.
|
|
1854
|
-
// optimizeSizeUpdate가 true일 경우에는 플리킹 방향에 대응되는 뷰포트 사이즈 요소가 변경되었을 때만 패널들을 리렌더링한다.
|
|
1855
|
-
// 자세한 사항은 optimizeSizeUpdate 옵션의 설명을 참고.
|
|
1856
|
-
if (this._optimizeSizeUpdate) {
|
|
1857
|
-
if ((this.horizontal && viewport.width !== prevWidth) || (!this.horizontal && viewport.height !== prevHeight)) {
|
|
1858
|
-
await renderer.forceRenderAllPanels();
|
|
1859
|
-
}
|
|
1860
|
-
} else {
|
|
1861
|
-
await renderer.forceRenderAllPanels(); // Render all panel elements, to update sizes
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1527
|
+
await renderer.forceRenderAllPanels(); // Render all panel elements, to update sizes
|
|
1864
1528
|
if (!this._initialized) {
|
|
1865
1529
|
return;
|
|
1866
1530
|
}
|
|
@@ -1887,20 +1551,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1887
1551
|
const newHeight = viewport.height;
|
|
1888
1552
|
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
1889
1553
|
|
|
1890
|
-
this.trigger(
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
})
|
|
1901
|
-
);
|
|
1902
|
-
|
|
1903
|
-
this._isResizing = false;
|
|
1554
|
+
this.trigger(new ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
1555
|
+
width: viewport.width,
|
|
1556
|
+
height: viewport.height,
|
|
1557
|
+
prev: {
|
|
1558
|
+
width: prevWidth,
|
|
1559
|
+
height: prevHeight
|
|
1560
|
+
},
|
|
1561
|
+
sizeChanged,
|
|
1562
|
+
element: viewport.element
|
|
1563
|
+
}));
|
|
1904
1564
|
}
|
|
1905
1565
|
|
|
1906
1566
|
/**
|
|
@@ -1974,17 +1634,10 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1974
1634
|
*/
|
|
1975
1635
|
public insert(index: number, element: ElementLike | ElementLike[]): Panel[] {
|
|
1976
1636
|
if (this._renderExternal) {
|
|
1977
|
-
throw new FlickingError(
|
|
1978
|
-
ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
|
|
1979
|
-
ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
|
|
1980
|
-
);
|
|
1637
|
+
throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
|
|
1981
1638
|
}
|
|
1982
1639
|
|
|
1983
|
-
return this._renderer.batchInsert({
|
|
1984
|
-
index,
|
|
1985
|
-
elements: parseElement(element),
|
|
1986
|
-
hasDOMInElements: true
|
|
1987
|
-
});
|
|
1640
|
+
return this._renderer.batchInsert({ index, elements: parseElement(element), hasDOMInElements: true });
|
|
1988
1641
|
}
|
|
1989
1642
|
|
|
1990
1643
|
/**
|
|
@@ -1998,34 +1651,26 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1998
1651
|
*/
|
|
1999
1652
|
public remove(index: number, deleteCount: number = 1): Panel[] {
|
|
2000
1653
|
if (this._renderExternal) {
|
|
2001
|
-
throw new FlickingError(
|
|
2002
|
-
ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
|
|
2003
|
-
ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
|
|
2004
|
-
);
|
|
1654
|
+
throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
|
|
2005
1655
|
}
|
|
2006
1656
|
|
|
2007
|
-
return this._renderer.batchRemove({
|
|
2008
|
-
index,
|
|
2009
|
-
deleteCount,
|
|
2010
|
-
hasDOMInElements: true
|
|
2011
|
-
});
|
|
1657
|
+
return this._renderer.batchRemove({ index, deleteCount, hasDOMInElements: true });
|
|
2012
1658
|
}
|
|
2013
1659
|
|
|
2014
1660
|
private _createControl(): Control {
|
|
2015
1661
|
const moveType = this._moveType;
|
|
2016
|
-
const moveTypes = Object.keys(MOVE_TYPE).map(
|
|
2017
|
-
(key) => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>
|
|
2018
|
-
);
|
|
1662
|
+
const moveTypes = Object.keys(MOVE_TYPE).map(key => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>);
|
|
2019
1663
|
|
|
2020
|
-
const moveTypeStr = Array.isArray(moveType)
|
|
1664
|
+
const moveTypeStr = Array.isArray(moveType)
|
|
1665
|
+
? moveType[0]
|
|
1666
|
+
: moveType;
|
|
2021
1667
|
|
|
2022
|
-
const moveTypeOptions = Array.isArray(moveType)
|
|
1668
|
+
const moveTypeOptions = Array.isArray(moveType)
|
|
1669
|
+
? moveType[1] ?? {}
|
|
1670
|
+
: {};
|
|
2023
1671
|
|
|
2024
1672
|
if (!includes(moveTypes, moveTypeStr)) {
|
|
2025
|
-
throw new FlickingError(
|
|
2026
|
-
ERROR.MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
|
|
2027
|
-
ERROR.CODE.WRONG_OPTION
|
|
2028
|
-
);
|
|
1673
|
+
throw new FlickingError(ERROR.MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)), ERROR.CODE.WRONG_OPTION);
|
|
2029
1674
|
}
|
|
2030
1675
|
|
|
2031
1676
|
switch (moveTypeStr) {
|
|
@@ -2041,9 +1686,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2041
1686
|
private _createCamera(): Camera {
|
|
2042
1687
|
if (this._circular && this._bound) {
|
|
2043
1688
|
// eslint-disable-next-line no-console
|
|
2044
|
-
console.warn(
|
|
2045
|
-
"\"circular\" and \"bound\" option cannot be used together, ignoring bound."
|
|
2046
|
-
);
|
|
1689
|
+
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
2047
1690
|
}
|
|
2048
1691
|
|
|
2049
1692
|
return new Camera(this, {
|
|
@@ -2055,9 +1698,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2055
1698
|
const externalRenderer = this._externalRenderer;
|
|
2056
1699
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
2057
1700
|
// eslint-disable-next-line no-console
|
|
2058
|
-
console.warn(
|
|
2059
|
-
"\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual."
|
|
2060
|
-
);
|
|
1701
|
+
console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
|
|
2061
1702
|
}
|
|
2062
1703
|
|
|
2063
1704
|
return externalRenderer
|
|
@@ -2068,9 +1709,12 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2068
1709
|
}
|
|
2069
1710
|
|
|
2070
1711
|
private _createExternalRenderer(): ExternalRenderer {
|
|
2071
|
-
const {
|
|
1712
|
+
const {
|
|
1713
|
+
renderer,
|
|
1714
|
+
rendererOptions
|
|
1715
|
+
} = this._renderExternal!;
|
|
2072
1716
|
|
|
2073
|
-
return new renderer({ align: this._align, ...rendererOptions });
|
|
1717
|
+
return new (renderer)({ align: this._align, ...rendererOptions });
|
|
2074
1718
|
}
|
|
2075
1719
|
|
|
2076
1720
|
private _createVanillaRenderer(): VanillaRenderer {
|
|
@@ -2090,25 +1734,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2090
1734
|
const renderer = this._renderer;
|
|
2091
1735
|
const control = this._control;
|
|
2092
1736
|
const camera = this._camera;
|
|
2093
|
-
const defaultPanel =
|
|
2094
|
-
renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
1737
|
+
const defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
2095
1738
|
|
|
2096
1739
|
if (!defaultPanel) return;
|
|
2097
1740
|
|
|
2098
1741
|
const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
|
|
2099
|
-
const initialPanel =
|
|
2100
|
-
nearestAnchor &&
|
|
2101
|
-
defaultPanel.position !== nearestAnchor.panel.position &&
|
|
2102
|
-
defaultPanel.index !== nearestAnchor.panel.index
|
|
2103
|
-
? nearestAnchor.panel
|
|
2104
|
-
: defaultPanel;
|
|
1742
|
+
const initialPanel = (nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index) ? nearestAnchor.panel : defaultPanel;
|
|
2105
1743
|
control.setActive(initialPanel, null, false);
|
|
2106
1744
|
|
|
2107
1745
|
if (!nearestAnchor) {
|
|
2108
|
-
throw new FlickingError(
|
|
2109
|
-
ERROR.MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position),
|
|
2110
|
-
ERROR.CODE.POSITION_NOT_REACHABLE
|
|
2111
|
-
);
|
|
1746
|
+
throw new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), ERROR.CODE.POSITION_NOT_REACHABLE);
|
|
2112
1747
|
}
|
|
2113
1748
|
|
|
2114
1749
|
let position = initialPanel.position;
|
|
@@ -2128,13 +1763,11 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2128
1763
|
const camera = this._camera;
|
|
2129
1764
|
const control = this._control;
|
|
2130
1765
|
|
|
2131
|
-
this.trigger(
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
})
|
|
2137
|
-
);
|
|
1766
|
+
this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
1767
|
+
width: 0,
|
|
1768
|
+
height: 0,
|
|
1769
|
+
element: viewport.element
|
|
1770
|
+
}));
|
|
2138
1771
|
|
|
2139
1772
|
viewport.resize();
|
|
2140
1773
|
renderer.updatePanelSize();
|
|
@@ -2148,18 +1781,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2148
1781
|
const newHeight = viewport.height;
|
|
2149
1782
|
const sizeChanged = newWidth !== 0 || newHeight !== 0;
|
|
2150
1783
|
|
|
2151
|
-
this.trigger(
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
})
|
|
2162
|
-
);
|
|
1784
|
+
this.trigger(new ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
1785
|
+
width: viewport.width,
|
|
1786
|
+
height: viewport.height,
|
|
1787
|
+
prev: {
|
|
1788
|
+
width: 0,
|
|
1789
|
+
height: 0
|
|
1790
|
+
},
|
|
1791
|
+
sizeChanged,
|
|
1792
|
+
element: viewport.element
|
|
1793
|
+
}));
|
|
2163
1794
|
}
|
|
2164
1795
|
}
|
|
2165
1796
|
|