@egjs/flicking 4.12.1-beta.3 → 4.12.1-beta.4
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 +2 -3
- package/declaration/control/Control.d.ts +1 -1
- package/dist/flicking.cjs.js +20 -45
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +20 -45
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +20 -45
- 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 +38 -48
- 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 +200 -449
- package/src/control/Control.ts +1 -1
- package/src/control/SnapControl.ts +12 -6
- package/src/core/AutoResizer.ts +11 -40
- 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;
|
|
@@ -220,7 +176,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
220
176
|
// Internal State
|
|
221
177
|
private _initialized: boolean;
|
|
222
178
|
private _plugins: Plugin[];
|
|
223
|
-
private _isResizing: boolean;
|
|
224
179
|
|
|
225
180
|
// Components
|
|
226
181
|
/**
|
|
@@ -233,9 +188,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
233
188
|
* @see SnapControl
|
|
234
189
|
* @see FreeControl
|
|
235
190
|
*/
|
|
236
|
-
public get control() {
|
|
237
|
-
return this._control;
|
|
238
|
-
}
|
|
191
|
+
public get control() { return this._control; }
|
|
239
192
|
/**
|
|
240
193
|
* {@link Camera} instance of the Flicking
|
|
241
194
|
* @ko 현재 Flicking에 활성화된 {@link Camera} 인스턴스
|
|
@@ -247,9 +200,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
247
200
|
* @see BoundCamera
|
|
248
201
|
* @see CircularCamera
|
|
249
202
|
*/
|
|
250
|
-
public get camera() {
|
|
251
|
-
return this._camera;
|
|
252
|
-
}
|
|
203
|
+
public get camera() { return this._camera; }
|
|
253
204
|
/**
|
|
254
205
|
* {@link Renderer} instance of the Flicking
|
|
255
206
|
* @ko 현재 Flicking에 활성화된 {@link Renderer} 인스턴스
|
|
@@ -260,9 +211,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
260
211
|
* @see VanillaRenderer
|
|
261
212
|
* @see ExternalRenderer
|
|
262
213
|
*/
|
|
263
|
-
public get renderer() {
|
|
264
|
-
return this._renderer;
|
|
265
|
-
}
|
|
214
|
+
public get renderer() { return this._renderer; }
|
|
266
215
|
/**
|
|
267
216
|
* A component that manages viewport size
|
|
268
217
|
* @ko 뷰포트 크기 정보를 담당하는 컴포넌트
|
|
@@ -270,9 +219,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
270
219
|
* @readonly
|
|
271
220
|
* @see Viewport
|
|
272
221
|
*/
|
|
273
|
-
public get viewport() {
|
|
274
|
-
return this._viewport;
|
|
275
|
-
}
|
|
222
|
+
public get viewport() { return this._viewport; }
|
|
276
223
|
// Internal States
|
|
277
224
|
/**
|
|
278
225
|
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
@@ -283,9 +230,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
283
230
|
* @default false
|
|
284
231
|
* @readonly
|
|
285
232
|
*/
|
|
286
|
-
public get initialized() {
|
|
287
|
-
return this._initialized;
|
|
288
|
-
}
|
|
233
|
+
public get initialized() { return this._initialized; }
|
|
289
234
|
/**
|
|
290
235
|
* Whether the `circular` option is enabled.
|
|
291
236
|
* The {@link Flicking#circular circular} option can't be enabled when sum of the panel sizes are too small.
|
|
@@ -295,9 +240,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
295
240
|
* @default false
|
|
296
241
|
* @readonly
|
|
297
242
|
*/
|
|
298
|
-
public get circularEnabled() {
|
|
299
|
-
return this._camera.circularEnabled;
|
|
300
|
-
}
|
|
243
|
+
public get circularEnabled() { return this._camera.circularEnabled; }
|
|
301
244
|
/**
|
|
302
245
|
* Whether the `virtual` option is enabled.
|
|
303
246
|
* The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
|
|
@@ -307,9 +250,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
307
250
|
* @default false
|
|
308
251
|
* @readonly
|
|
309
252
|
*/
|
|
310
|
-
public get virtualEnabled() {
|
|
311
|
-
return this._panelsPerView > 0 && this._virtual != null;
|
|
312
|
-
}
|
|
253
|
+
public get virtualEnabled() { return this._panelsPerView > 0 && this._virtual != null; }
|
|
313
254
|
/**
|
|
314
255
|
* Index number of the {@link Flicking#currentPanel currentPanel}
|
|
315
256
|
* @ko {@link Flicking#currentPanel currentPanel}의 인덱스 번호
|
|
@@ -317,18 +258,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
317
258
|
* @default 0
|
|
318
259
|
* @readonly
|
|
319
260
|
*/
|
|
320
|
-
public get index() {
|
|
321
|
-
return this._control.activeIndex;
|
|
322
|
-
}
|
|
261
|
+
public get index() { return this._control.activeIndex; }
|
|
323
262
|
/**
|
|
324
263
|
* The root(`.flicking-viewport`) element
|
|
325
264
|
* @ko root(`.flicking-viewport`) 엘리먼트
|
|
326
265
|
* @type {HTMLElement}
|
|
327
266
|
* @readonly
|
|
328
267
|
*/
|
|
329
|
-
public get element() {
|
|
330
|
-
return this._viewport.element;
|
|
331
|
-
}
|
|
268
|
+
public get element() { return this._viewport.element; }
|
|
332
269
|
/**
|
|
333
270
|
* Currently active panel
|
|
334
271
|
* @ko 현재 선택된 패널
|
|
@@ -336,9 +273,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
336
273
|
* @readonly
|
|
337
274
|
* @see Panel
|
|
338
275
|
*/
|
|
339
|
-
public get currentPanel() {
|
|
340
|
-
return this._control.activePanel;
|
|
341
|
-
}
|
|
276
|
+
public get currentPanel() { return this._control.activePanel; }
|
|
342
277
|
/**
|
|
343
278
|
* Array of panels
|
|
344
279
|
* @ko 전체 패널들의 배열
|
|
@@ -346,18 +281,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
346
281
|
* @readonly
|
|
347
282
|
* @see Panel
|
|
348
283
|
*/
|
|
349
|
-
public get panels() {
|
|
350
|
-
return this._renderer.panels;
|
|
351
|
-
}
|
|
284
|
+
public get panels() { return this._renderer.panels; }
|
|
352
285
|
/**
|
|
353
286
|
* Count of panels
|
|
354
287
|
* @ko 전체 패널의 개수
|
|
355
288
|
* @type {number}
|
|
356
289
|
* @readonly
|
|
357
290
|
*/
|
|
358
|
-
public get panelCount() {
|
|
359
|
-
return this._renderer.panelCount;
|
|
360
|
-
}
|
|
291
|
+
public get panelCount() { return this._renderer.panelCount; }
|
|
361
292
|
/**
|
|
362
293
|
* Array of panels that is visible at the current position
|
|
363
294
|
* @ko 현재 보이는 패널의 배열
|
|
@@ -365,36 +296,28 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
365
296
|
* @readonly
|
|
366
297
|
* @see Panel
|
|
367
298
|
*/
|
|
368
|
-
public get visiblePanels() {
|
|
369
|
-
return this._camera.visiblePanels;
|
|
370
|
-
}
|
|
299
|
+
public get visiblePanels() { return this._camera.visiblePanels; }
|
|
371
300
|
/**
|
|
372
301
|
* Whether Flicking's animating
|
|
373
302
|
* @ko 현재 애니메이션 동작 여부
|
|
374
303
|
* @type {boolean}
|
|
375
304
|
* @readonly
|
|
376
305
|
*/
|
|
377
|
-
public get animating() {
|
|
378
|
-
return this._control.animating;
|
|
379
|
-
}
|
|
306
|
+
public get animating() { return this._control.animating; }
|
|
380
307
|
/**
|
|
381
308
|
* Whether user is clicking or touching
|
|
382
309
|
* @ko 현재 사용자가 클릭/터치중인지 여부
|
|
383
310
|
* @type {boolean}
|
|
384
311
|
* @readonly
|
|
385
312
|
*/
|
|
386
|
-
public get holding() {
|
|
387
|
-
return this._control.holding;
|
|
388
|
-
}
|
|
313
|
+
public get holding() { return this._control.holding; }
|
|
389
314
|
/**
|
|
390
315
|
* A current list of activated plugins
|
|
391
316
|
* @ko 현재 활성화된 플러그인 목록
|
|
392
317
|
* @type {Plugin[]}
|
|
393
318
|
* @readonly
|
|
394
319
|
*/
|
|
395
|
-
public get activePlugins() {
|
|
396
|
-
return this._plugins;
|
|
397
|
-
}
|
|
320
|
+
public get activePlugins() { return this._plugins; }
|
|
398
321
|
|
|
399
322
|
// Options Getter
|
|
400
323
|
// UI / LAYOUT
|
|
@@ -426,9 +349,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
426
349
|
* });
|
|
427
350
|
* ```
|
|
428
351
|
*/
|
|
429
|
-
public get align() {
|
|
430
|
-
return this._align;
|
|
431
|
-
}
|
|
352
|
+
public get align() { return this._align; }
|
|
432
353
|
/**
|
|
433
354
|
* Index of the panel to move when Flicking's {@link Flicking#init init()} is called. A zero-based integer
|
|
434
355
|
* @ko Flicking의 {@link Flicking#init init()}이 호출될 때 이동할 디폴트 패널의 인덱스로, 0부터 시작하는 정수입니다.
|
|
@@ -436,9 +357,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
436
357
|
* @default 0
|
|
437
358
|
* @see {@link https://naver.github.io/egjs-flicking/Options#defaultindex defaultIndex ( Options )}
|
|
438
359
|
*/
|
|
439
|
-
public get defaultIndex() {
|
|
440
|
-
return this._defaultIndex;
|
|
441
|
-
}
|
|
360
|
+
public get defaultIndex() { return this._defaultIndex; }
|
|
442
361
|
/**
|
|
443
362
|
* Direction of panel movement (true: horizontal, false: vertical)
|
|
444
363
|
* @ko 패널 이동 방향 (true: 가로방향, false: 세로방향)
|
|
@@ -446,9 +365,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
446
365
|
* @default true
|
|
447
366
|
* @see {@link https://naver.github.io/egjs-flicking/Options#horizontal horizontal ( Options )}
|
|
448
367
|
*/
|
|
449
|
-
public get horizontal() {
|
|
450
|
-
return this._horizontal;
|
|
451
|
-
}
|
|
368
|
+
public get horizontal() { return this._horizontal; }
|
|
452
369
|
/**
|
|
453
370
|
* Enables circular(continuous loop) mode, which connects first/last panel for continuous scrolling.
|
|
454
371
|
* @ko 순환 모드를 활성화합니다. 순환 모드에서는 양 끝의 패널이 서로 연결되어 끊김없는 스크롤이 가능합니다.
|
|
@@ -456,9 +373,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
456
373
|
* @default false
|
|
457
374
|
* @see {@link https://naver.github.io/egjs-flicking/Options#circular circular ( Options )}
|
|
458
375
|
*/
|
|
459
|
-
public get circular() {
|
|
460
|
-
return this._circular;
|
|
461
|
-
}
|
|
376
|
+
public get circular() { return this._circular; }
|
|
462
377
|
/**
|
|
463
378
|
* Set panel control mode for the case when circular cannot be enabled.
|
|
464
379
|
* "linear" will set the view's range from the top of the first panel to the top of the last panel.
|
|
@@ -471,9 +386,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
471
386
|
* @default "linear"
|
|
472
387
|
* @see {@link https://naver.github.io/egjs-flicking/Options#circularfallback circularFallback ( Options )}
|
|
473
388
|
*/
|
|
474
|
-
public get circularFallback() {
|
|
475
|
-
return this._circularFallback;
|
|
476
|
-
}
|
|
389
|
+
public get circularFallback() { return this._circularFallback; }
|
|
477
390
|
/**
|
|
478
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
|
|
479
392
|
* Only can be enabled when `circular=false`
|
|
@@ -483,9 +396,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
483
396
|
* @default false
|
|
484
397
|
* @see {@link https://naver.github.io/egjs-flicking/Options#bound bound ( Options )}
|
|
485
398
|
*/
|
|
486
|
-
public get bound() {
|
|
487
|
-
return this._bound;
|
|
488
|
-
}
|
|
399
|
+
public get bound() { return this._bound; }
|
|
489
400
|
/**
|
|
490
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`
|
|
491
402
|
* @ko 이동한 후 뷰포트 엘리먼트의 크기를 현재 패널의 높이와 동일하게 설정합니다. `horizontal=true`인 경우에만 사용할 수 있습니다.
|
|
@@ -493,9 +404,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
493
404
|
* @default false
|
|
494
405
|
* @see {@link https://naver.github.io/egjs-flicking/Options#adaptive adaptive ( Options )}
|
|
495
406
|
*/
|
|
496
|
-
public get adaptive() {
|
|
497
|
-
return this._adaptive;
|
|
498
|
-
}
|
|
407
|
+
public get adaptive() { return this._adaptive; }
|
|
499
408
|
/**
|
|
500
409
|
* A visible number of panels on viewport. Enabling this option will automatically resize panel size
|
|
501
410
|
* @ko 한 화면에 보이는 패널의 개수. 이 옵션을 활성화할 경우 패널의 크기를 강제로 재조정합니다
|
|
@@ -503,9 +412,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
503
412
|
* @default -1
|
|
504
413
|
* @see {@link https://naver.github.io/egjs-flicking/Options#panelsperview panelsPerView ( Options )}
|
|
505
414
|
*/
|
|
506
|
-
public get panelsPerView() {
|
|
507
|
-
return this._panelsPerView;
|
|
508
|
-
}
|
|
415
|
+
public get panelsPerView() { return this._panelsPerView; }
|
|
509
416
|
/**
|
|
510
417
|
* Enabling this option will not change `width/height` style of the panels if {@link Flicking#panelsPerView} is enabled.
|
|
511
418
|
* This behavior can be useful in terms of performance when you're manually managing all panel sizes
|
|
@@ -514,9 +421,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
514
421
|
* @type {boolean}
|
|
515
422
|
* @default false
|
|
516
423
|
*/
|
|
517
|
-
public get noPanelStyleOverride() {
|
|
518
|
-
return this._noPanelStyleOverride;
|
|
519
|
-
}
|
|
424
|
+
public get noPanelStyleOverride() { return this._noPanelStyleOverride; }
|
|
520
425
|
/**
|
|
521
426
|
* Enabling this option will automatically call {@link Flicking#resize} when all image/video inside panels are loaded.
|
|
522
427
|
* This can be useful when you have contents inside Flicking that changes its size when it's loaded
|
|
@@ -526,9 +431,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
526
431
|
* @default false
|
|
527
432
|
* @see {@link https://naver.github.io/egjs-flicking/Options#resizeOnContentsReady resizeOnContentsReady ( Options )}
|
|
528
433
|
*/
|
|
529
|
-
public get resizeOnContentsReady() {
|
|
530
|
-
return this._resizeOnContentsReady;
|
|
531
|
-
}
|
|
434
|
+
public get resizeOnContentsReady() { return this._resizeOnContentsReady; }
|
|
532
435
|
/**
|
|
533
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.
|
|
534
437
|
* If the parent Flicking and child Flicking have different horizontal option, you do not need to set this option.
|
|
@@ -538,9 +441,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
538
441
|
* @default false
|
|
539
442
|
* @see {@link https://naver.github.io/egjs-flicking/Options#nested nested ( Options )}
|
|
540
443
|
*/
|
|
541
|
-
public get nested() {
|
|
542
|
-
return this._nested;
|
|
543
|
-
}
|
|
444
|
+
public get nested() { return this._nested; }
|
|
544
445
|
// EVENTS
|
|
545
446
|
/**
|
|
546
447
|
* A Threshold from viewport edge before triggering `needPanel` event
|
|
@@ -549,9 +450,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
549
450
|
* @default 0
|
|
550
451
|
* @see {@link https://naver.github.io/egjs-flicking/Options#needpanelthreshold needPanelThreshold ( Options )}
|
|
551
452
|
*/
|
|
552
|
-
public get needPanelThreshold() {
|
|
553
|
-
return this._needPanelThreshold;
|
|
554
|
-
}
|
|
453
|
+
public get needPanelThreshold() { return this._needPanelThreshold; }
|
|
555
454
|
/**
|
|
556
455
|
* When enabled, events are not triggered before `ready` when initializing
|
|
557
456
|
* @ko 활성화할 경우 초기화시 `ready` 이벤트 이전의 이벤트가 발생하지 않습니다.
|
|
@@ -559,9 +458,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
559
458
|
* @default true
|
|
560
459
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventeventsbeforeinit preventEventsBeforeInit ( Options )}
|
|
561
460
|
*/
|
|
562
|
-
public get preventEventsBeforeInit() {
|
|
563
|
-
return this._preventEventsBeforeInit;
|
|
564
|
-
}
|
|
461
|
+
public get preventEventsBeforeInit() { return this._preventEventsBeforeInit; }
|
|
565
462
|
// ANIMATION
|
|
566
463
|
/**
|
|
567
464
|
* Deceleration value for panel movement animation which is triggered by user input. A higher value means a shorter animation time
|
|
@@ -570,9 +467,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
570
467
|
* @default 0.0075
|
|
571
468
|
* @see {@link https://naver.github.io/egjs-flicking/Options#deceleration deceleration ( Options )}
|
|
572
469
|
*/
|
|
573
|
-
public get deceleration() {
|
|
574
|
-
return this._deceleration;
|
|
575
|
-
}
|
|
470
|
+
public get deceleration() { return this._deceleration; }
|
|
576
471
|
/**
|
|
577
472
|
* An easing function applied to the panel movement animation. Default value is `easeOutCubic`
|
|
578
473
|
* @ko 패널 이동 애니메이션에 적용할 easing 함수. 기본값은 `easeOutCubic`이다
|
|
@@ -581,9 +476,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
581
476
|
* @see Easing Functions Cheat Sheet {@link http://easings.net/} <ko>이징 함수 Cheat Sheet {@link http://easings.net/}</ko>
|
|
582
477
|
* @see {@link https://naver.github.io/egjs-flicking/Options#easing Easing ( Options )}
|
|
583
478
|
*/
|
|
584
|
-
public get easing() {
|
|
585
|
-
return this._easing;
|
|
586
|
-
}
|
|
479
|
+
public get easing() { return this._easing; }
|
|
587
480
|
/**
|
|
588
481
|
* Default duration of the animation (ms)
|
|
589
482
|
* @ko 디폴트 애니메이션 재생 시간 (ms)
|
|
@@ -591,9 +484,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
591
484
|
* @default 500
|
|
592
485
|
* @see {@link https://naver.github.io/egjs-flicking/Options#duration duration ( Options )}
|
|
593
486
|
*/
|
|
594
|
-
public get duration() {
|
|
595
|
-
return this._duration;
|
|
596
|
-
}
|
|
487
|
+
public get duration() { return this._duration; }
|
|
597
488
|
// INPUT
|
|
598
489
|
/**
|
|
599
490
|
* Types of input devices to enable
|
|
@@ -604,9 +495,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
604
495
|
* <ko>{@link https://naver.github.io/egjs-axes/Options#paninput-options 가능한 값들 (PanInputOption#inputType)}</ko>
|
|
605
496
|
* @see {@link https://naver.github.io/egjs-flicking/Options#inputtype inputType ( Options )}
|
|
606
497
|
*/
|
|
607
|
-
public get inputType() {
|
|
608
|
-
return this._inputType;
|
|
609
|
-
}
|
|
498
|
+
public get inputType() { return this._inputType; }
|
|
610
499
|
/**
|
|
611
500
|
* Movement style by user input. This will change instance type of {@link Flicking#control}
|
|
612
501
|
* You can use the values of the constant {@link MOVE_TYPE}
|
|
@@ -638,9 +527,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
638
527
|
* });
|
|
639
528
|
* ```
|
|
640
529
|
*/
|
|
641
|
-
public get moveType() {
|
|
642
|
-
return this._moveType;
|
|
643
|
-
}
|
|
530
|
+
public get moveType() { return this._moveType; }
|
|
644
531
|
/**
|
|
645
532
|
* Movement threshold to change panel (unit: px). It should be dragged above the threshold to change the current panel.
|
|
646
533
|
* @ko 패널 변경을 위한 이동 임계값 (단위: px). 주어진 값 이상으로 스크롤해야만 패널 변경이 가능합니다.
|
|
@@ -648,9 +535,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
648
535
|
* @default 40
|
|
649
536
|
* @see {@link https://naver.github.io/egjs-flicking/Options#threshold Threshold ( Options )}
|
|
650
537
|
*/
|
|
651
|
-
public get threshold() {
|
|
652
|
-
return this._threshold;
|
|
653
|
-
}
|
|
538
|
+
public get threshold() { return this._threshold; }
|
|
654
539
|
/**
|
|
655
540
|
* Minimal distance of user input before recognizing (unit: px). It should be dragged above the dragThreshold to move the panel.
|
|
656
541
|
* @ko 사용자의 입력을 인식하기 위한 최소한의 거리 (단위: px). 주어진 값 이상으로 스크롤해야만 패널이 움직입니다.
|
|
@@ -658,9 +543,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
658
543
|
* @default 1
|
|
659
544
|
* @see {@link https://naver.github.io/egjs-flicking/Options#dragThreshold dragThreshold ( Options )}
|
|
660
545
|
*/
|
|
661
|
-
public get dragThreshold() {
|
|
662
|
-
return this._dragThreshold;
|
|
663
|
-
}
|
|
546
|
+
public get dragThreshold() { return this._dragThreshold; }
|
|
664
547
|
/**
|
|
665
548
|
* Set animation to be interruptable by click/touch.
|
|
666
549
|
* @ko 사용자의 클릭/터치로 인해 애니메이션을 도중에 멈출 수 있도록 설정합니다.
|
|
@@ -668,9 +551,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
668
551
|
* @default true
|
|
669
552
|
* @see {@link https://naver.github.io/egjs-flicking/Options#interruptable Interruptable ( Options )}
|
|
670
553
|
*/
|
|
671
|
-
public get interruptable() {
|
|
672
|
-
return this._interruptable;
|
|
673
|
-
}
|
|
554
|
+
public get interruptable() { return this._interruptable; }
|
|
674
555
|
/**
|
|
675
556
|
* The size value of the bounce area. Only can be enabled when `circular=false`.
|
|
676
557
|
* You can set different bounce value for prev/next direction by using array.
|
|
@@ -703,9 +584,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
703
584
|
* flicking.control.updateInput(); // Call this to update!
|
|
704
585
|
* ```
|
|
705
586
|
*/
|
|
706
|
-
public get bounce() {
|
|
707
|
-
return this._bounce;
|
|
708
|
-
}
|
|
587
|
+
public get bounce() { return this._bounce; }
|
|
709
588
|
/**
|
|
710
589
|
* Size of the area from the right edge in iOS safari (in px) which enables swipe-back or swipe-forward
|
|
711
590
|
* @ko iOS Safari에서 swipe를 통한 뒤로가기/앞으로가기를 활성화하는 오른쪽 끝으로부터의 영역의 크기 (px)
|
|
@@ -713,9 +592,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
713
592
|
* @default 30
|
|
714
593
|
* @see {@link https://naver.github.io/egjs-flicking/Options#iosedgeswipethreshold iOSEdgeSwipeThreshold ( Options )}
|
|
715
594
|
*/
|
|
716
|
-
public get iOSEdgeSwipeThreshold() {
|
|
717
|
-
return this._iOSEdgeSwipeThreshold;
|
|
718
|
-
}
|
|
595
|
+
public get iOSEdgeSwipeThreshold() { return this._iOSEdgeSwipeThreshold; }
|
|
719
596
|
/**
|
|
720
597
|
* Automatically prevent `click` event if the user has dragged at least a single pixel on the viewport element
|
|
721
598
|
* @ko 사용자가 뷰포트 영역을 1픽셀이라도 드래그했을 경우 자동으로 {@link https://developer.mozilla.org/ko/docs/Web/API/Element/click_event click} 이벤트를 취소합니다
|
|
@@ -723,9 +600,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
723
600
|
* @default true
|
|
724
601
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventclickondrag preventClickOnDrag ( Options )}
|
|
725
602
|
*/
|
|
726
|
-
public get preventClickOnDrag() {
|
|
727
|
-
return this._preventClickOnDrag;
|
|
728
|
-
}
|
|
603
|
+
public get preventClickOnDrag() { return this._preventClickOnDrag; }
|
|
729
604
|
/**
|
|
730
605
|
* Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} when the user starts dragging
|
|
731
606
|
* @ko 사용자가 드래그를 시작할 때 {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} 실행 여부
|
|
@@ -733,9 +608,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
733
608
|
* @default false
|
|
734
609
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventDefaultOnDrag preventDefaultOnDrag ( Options )}
|
|
735
610
|
*/
|
|
736
|
-
public get preventDefaultOnDrag() {
|
|
737
|
-
return this._preventDefaultOnDrag;
|
|
738
|
-
}
|
|
611
|
+
public get preventDefaultOnDrag() { return this._preventDefaultOnDrag; }
|
|
739
612
|
/**
|
|
740
613
|
* Automatically call {@link Flicking#disableInput disableInput()} on initialization
|
|
741
614
|
* @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다
|
|
@@ -743,9 +616,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
743
616
|
* @default false
|
|
744
617
|
* @see {@link https://naver.github.io/egjs-flicking/Options#disableoninit disableOnInit ( Options )}
|
|
745
618
|
*/
|
|
746
|
-
public get disableOnInit() {
|
|
747
|
-
return this._disableOnInit;
|
|
748
|
-
}
|
|
619
|
+
public get disableOnInit() { return this._disableOnInit; }
|
|
749
620
|
/**
|
|
750
621
|
* Change active panel index on mouse/touch hold while animating.
|
|
751
622
|
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
@@ -755,9 +626,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
755
626
|
* @default false
|
|
756
627
|
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
757
628
|
*/
|
|
758
|
-
public get changeOnHold() {
|
|
759
|
-
return this._changeOnHold;
|
|
760
|
-
}
|
|
629
|
+
public get changeOnHold() { return this._changeOnHold; }
|
|
761
630
|
// PERFORMANCE
|
|
762
631
|
/**
|
|
763
632
|
* Whether to render visible panels only. This can dramatically increase performance when there're many panels
|
|
@@ -766,9 +635,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
766
635
|
* @default false
|
|
767
636
|
* @see {@link https://naver.github.io/egjs-flicking/Options#renderonlyvisible renderOnlyVisible ( Options )}
|
|
768
637
|
*/
|
|
769
|
-
public get renderOnlyVisible() {
|
|
770
|
-
return this._renderOnlyVisible;
|
|
771
|
-
}
|
|
638
|
+
public get renderOnlyVisible() { return this._renderOnlyVisible; }
|
|
772
639
|
/**
|
|
773
640
|
* By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
|
|
774
641
|
* Must be used with `panelsPerview`.
|
|
@@ -801,9 +668,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
801
668
|
* flicking.virtual.remove(0, 100);
|
|
802
669
|
* ```
|
|
803
670
|
*/
|
|
804
|
-
public get virtual() {
|
|
805
|
-
return this._virtualManager;
|
|
806
|
-
}
|
|
671
|
+
public get virtual() { return this._virtualManager; }
|
|
807
672
|
|
|
808
673
|
// OTHERS
|
|
809
674
|
/**
|
|
@@ -814,18 +679,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
814
679
|
* @see {@link https://naver.github.io/egjs-flicking/Options#autoinit autoInit ( Options )}
|
|
815
680
|
* @readonly
|
|
816
681
|
*/
|
|
817
|
-
public get autoInit() {
|
|
818
|
-
return this._autoInit;
|
|
819
|
-
}
|
|
682
|
+
public get autoInit() { return this._autoInit; }
|
|
820
683
|
/**
|
|
821
684
|
* Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
|
|
822
685
|
* @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
|
|
823
686
|
* @type {boolean}
|
|
824
687
|
* @default true
|
|
825
688
|
*/
|
|
826
|
-
public get autoResize() {
|
|
827
|
-
return this._autoResize;
|
|
828
|
-
}
|
|
689
|
+
public get autoResize() { return this._autoResize; }
|
|
829
690
|
/**
|
|
830
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
|
|
831
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} 이벤트 대신 수신할지 여부를 설정합니다
|
|
@@ -833,9 +694,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
833
694
|
* @default true
|
|
834
695
|
* @see {@link https://naver.github.io/egjs-flicking/Options#useresizeobserver useResizeObserver ( Options )}
|
|
835
696
|
*/
|
|
836
|
-
public get useResizeObserver() {
|
|
837
|
-
return this._useResizeObserver;
|
|
838
|
-
}
|
|
697
|
+
public get useResizeObserver() { return this._useResizeObserver; }
|
|
839
698
|
/**
|
|
840
699
|
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
841
700
|
* If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
|
|
@@ -847,9 +706,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
847
706
|
* @default 0
|
|
848
707
|
* @see {@link https://naver.github.io/egjs-flicking/Options#resizedebounce resizeDebounce ( Options )}
|
|
849
708
|
*/
|
|
850
|
-
public get resizeDebounce() {
|
|
851
|
-
return this._resizeDebounce;
|
|
852
|
-
}
|
|
709
|
+
public get resizeDebounce() { return this._resizeDebounce; }
|
|
853
710
|
/**
|
|
854
711
|
* The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
|
|
855
712
|
* This guarantees that size recalculation is performed at least once every (n)ms.
|
|
@@ -859,9 +716,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
859
716
|
* @default 100
|
|
860
717
|
* @see {@link https://naver.github.io/egjs-flicking/Options#maxresizedebounce maxResizeDebounce ( Options )}
|
|
861
718
|
*/
|
|
862
|
-
public get maxResizeDebounce() {
|
|
863
|
-
return this._maxResizeDebounce;
|
|
864
|
-
}
|
|
719
|
+
public get maxResizeDebounce() { return this._maxResizeDebounce; }
|
|
865
720
|
/**
|
|
866
721
|
* By enabling this, Flicking will calculate all internal size with CSS width computed with getComputedStyle.
|
|
867
722
|
* This can prevent 1px offset issue in some cases where panel size has the fractional part.
|
|
@@ -873,9 +728,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
873
728
|
* @default false
|
|
874
729
|
* @see {@link https://naver.github.io/egjs-flicking/Options#usefractionalsize useFractionalSize ( Options )}
|
|
875
730
|
*/
|
|
876
|
-
public get useFractionalSize() {
|
|
877
|
-
return this._useFractionalSize;
|
|
878
|
-
}
|
|
731
|
+
public get useFractionalSize() { return this._useFractionalSize; }
|
|
879
732
|
/**
|
|
880
733
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
881
734
|
* @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
|
|
@@ -883,9 +736,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
883
736
|
* @internal
|
|
884
737
|
* @readonly
|
|
885
738
|
*/
|
|
886
|
-
public get externalRenderer() {
|
|
887
|
-
return this._externalRenderer;
|
|
888
|
-
}
|
|
739
|
+
public get externalRenderer() { return this._externalRenderer; }
|
|
889
740
|
/**
|
|
890
741
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
891
742
|
* @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
|
|
@@ -894,9 +745,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
894
745
|
* @readonly
|
|
895
746
|
* @deprecated
|
|
896
747
|
*/
|
|
897
|
-
public get renderExternal() {
|
|
898
|
-
return this._renderExternal;
|
|
899
|
-
}
|
|
748
|
+
public get renderExternal() { return this._renderExternal; }
|
|
900
749
|
|
|
901
750
|
// Options Setter
|
|
902
751
|
// UI / LAYOUT
|
|
@@ -907,9 +756,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
907
756
|
void this.resize();
|
|
908
757
|
}
|
|
909
758
|
|
|
910
|
-
public set defaultIndex(val: FlickingOptions["defaultIndex"]) {
|
|
911
|
-
this._defaultIndex = val;
|
|
912
|
-
}
|
|
759
|
+
public set defaultIndex(val: FlickingOptions["defaultIndex"]) { this._defaultIndex = val; }
|
|
913
760
|
public set horizontal(val: FlickingOptions["horizontal"]) {
|
|
914
761
|
this._horizontal = val;
|
|
915
762
|
this._control.controller.updateDirection();
|
|
@@ -936,16 +783,12 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
936
783
|
void this.resize();
|
|
937
784
|
}
|
|
938
785
|
|
|
939
|
-
public set noPanelStyleOverride(
|
|
940
|
-
val: FlickingOptions["noPanelStyleOverride"]
|
|
941
|
-
) {
|
|
786
|
+
public set noPanelStyleOverride(val: FlickingOptions["noPanelStyleOverride"]) {
|
|
942
787
|
this._noPanelStyleOverride = val;
|
|
943
788
|
void this.resize();
|
|
944
789
|
}
|
|
945
790
|
|
|
946
|
-
public set resizeOnContentsReady(
|
|
947
|
-
val: FlickingOptions["resizeOnContentsReady"]
|
|
948
|
-
) {
|
|
791
|
+
public set resizeOnContentsReady(val: FlickingOptions["resizeOnContentsReady"]) {
|
|
949
792
|
this._resizeOnContentsReady = val;
|
|
950
793
|
if (val) {
|
|
951
794
|
this._renderer.checkPanelContentsReady(this._renderer.panels);
|
|
@@ -962,14 +805,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
962
805
|
}
|
|
963
806
|
|
|
964
807
|
// EVENTS
|
|
965
|
-
public set needPanelThreshold(val: FlickingOptions["needPanelThreshold"]) {
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
public set preventEventsBeforeInit(
|
|
969
|
-
val: FlickingOptions["preventEventsBeforeInit"]
|
|
970
|
-
) {
|
|
971
|
-
this._preventEventsBeforeInit = val;
|
|
972
|
-
}
|
|
808
|
+
public set needPanelThreshold(val: FlickingOptions["needPanelThreshold"]) { this._needPanelThreshold = val; }
|
|
809
|
+
public set preventEventsBeforeInit(val: FlickingOptions["preventEventsBeforeInit"]) { this._preventEventsBeforeInit = val; }
|
|
973
810
|
// ANIMATION
|
|
974
811
|
public set deceleration(val: FlickingOptions["deceleration"]) {
|
|
975
812
|
this._deceleration = val;
|
|
@@ -989,9 +826,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
989
826
|
}
|
|
990
827
|
}
|
|
991
828
|
|
|
992
|
-
public set duration(val: FlickingOptions["duration"]) {
|
|
993
|
-
this._duration = val;
|
|
994
|
-
}
|
|
829
|
+
public set duration(val: FlickingOptions["duration"]) { this._duration = val; }
|
|
995
830
|
// INPUT
|
|
996
831
|
public set inputType(val: FlickingOptions["inputType"]) {
|
|
997
832
|
this._inputType = val;
|
|
@@ -1019,9 +854,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1019
854
|
this._control.updateInput();
|
|
1020
855
|
}
|
|
1021
856
|
|
|
1022
|
-
public set threshold(val: FlickingOptions["threshold"]) {
|
|
1023
|
-
this._threshold = val;
|
|
1024
|
-
}
|
|
857
|
+
public set threshold(val: FlickingOptions["threshold"]) { this._threshold = val; }
|
|
1025
858
|
|
|
1026
859
|
public set dragThreshold(val: FlickingOptions["dragThreshold"]) {
|
|
1027
860
|
this._dragThreshold = val;
|
|
@@ -1047,9 +880,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1047
880
|
this._control.updateInput();
|
|
1048
881
|
}
|
|
1049
882
|
|
|
1050
|
-
public set iOSEdgeSwipeThreshold(
|
|
1051
|
-
val: FlickingOptions["iOSEdgeSwipeThreshold"]
|
|
1052
|
-
) {
|
|
883
|
+
public set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]) {
|
|
1053
884
|
this._iOSEdgeSwipeThreshold = val;
|
|
1054
885
|
const panInput = this._control.controller.panInput;
|
|
1055
886
|
|
|
@@ -1074,9 +905,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1074
905
|
this._preventClickOnDrag = val;
|
|
1075
906
|
}
|
|
1076
907
|
|
|
1077
|
-
public set preventDefaultOnDrag(
|
|
1078
|
-
val: FlickingOptions["preventDefaultOnDrag"]
|
|
1079
|
-
) {
|
|
908
|
+
public set preventDefaultOnDrag(val: FlickingOptions["preventDefaultOnDrag"]) {
|
|
1080
909
|
this._preventDefaultOnDrag = val;
|
|
1081
910
|
const panInput = this._control.controller.panInput;
|
|
1082
911
|
|
|
@@ -1085,12 +914,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1085
914
|
}
|
|
1086
915
|
}
|
|
1087
916
|
|
|
1088
|
-
public set disableOnInit(val: FlickingOptions["disableOnInit"]) {
|
|
1089
|
-
|
|
1090
|
-
}
|
|
1091
|
-
public set changeOnHold(val: FlickingOptions["changeOnHold"]) {
|
|
1092
|
-
this._changeOnHold = val;
|
|
1093
|
-
}
|
|
917
|
+
public set disableOnInit(val: FlickingOptions["disableOnInit"]) { this._disableOnInit = val; }
|
|
918
|
+
public set changeOnHold(val: FlickingOptions["changeOnHold"]) { this._changeOnHold = val; }
|
|
1094
919
|
// PERFORMANCE
|
|
1095
920
|
public set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]) {
|
|
1096
921
|
this._renderOnlyVisible = val;
|
|
@@ -1144,54 +969,50 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1144
969
|
* const flicking2 = new Flicking(".flicking-viewport", { circular: true });
|
|
1145
970
|
* ```
|
|
1146
971
|
*/
|
|
1147
|
-
public constructor(
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
renderExternal = null,
|
|
1187
|
-
}: Partial<FlickingOptions> = {}
|
|
1188
|
-
) {
|
|
972
|
+
public constructor(root: HTMLElement | string, {
|
|
973
|
+
align = ALIGN.CENTER,
|
|
974
|
+
defaultIndex = 0,
|
|
975
|
+
horizontal = true,
|
|
976
|
+
circular = false,
|
|
977
|
+
circularFallback = CIRCULAR_FALLBACK.LINEAR,
|
|
978
|
+
bound = false,
|
|
979
|
+
adaptive = false,
|
|
980
|
+
panelsPerView = -1,
|
|
981
|
+
noPanelStyleOverride = false,
|
|
982
|
+
resizeOnContentsReady = false,
|
|
983
|
+
nested = false,
|
|
984
|
+
needPanelThreshold = 0,
|
|
985
|
+
preventEventsBeforeInit = true,
|
|
986
|
+
deceleration = 0.0075,
|
|
987
|
+
duration = 500,
|
|
988
|
+
easing = x => 1 - Math.pow(1 - x, 3),
|
|
989
|
+
inputType = ["mouse", "touch"],
|
|
990
|
+
moveType = "snap",
|
|
991
|
+
threshold = 40,
|
|
992
|
+
dragThreshold = 1,
|
|
993
|
+
interruptable = true,
|
|
994
|
+
bounce = "20%",
|
|
995
|
+
iOSEdgeSwipeThreshold = 30,
|
|
996
|
+
preventClickOnDrag = true,
|
|
997
|
+
preventDefaultOnDrag = false,
|
|
998
|
+
disableOnInit = false,
|
|
999
|
+
changeOnHold = false,
|
|
1000
|
+
renderOnlyVisible = false,
|
|
1001
|
+
virtual = null,
|
|
1002
|
+
autoInit = true,
|
|
1003
|
+
autoResize = true,
|
|
1004
|
+
useResizeObserver = true,
|
|
1005
|
+
resizeDebounce = 0,
|
|
1006
|
+
maxResizeDebounce = 100,
|
|
1007
|
+
useFractionalSize = false,
|
|
1008
|
+
externalRenderer = null,
|
|
1009
|
+
renderExternal = null
|
|
1010
|
+
}: Partial<FlickingOptions> = {}) {
|
|
1189
1011
|
super();
|
|
1190
1012
|
|
|
1191
1013
|
// Internal states
|
|
1192
1014
|
this._initialized = false;
|
|
1193
1015
|
this._plugins = [];
|
|
1194
|
-
this._isResizing = false;
|
|
1195
1016
|
|
|
1196
1017
|
// Bind options
|
|
1197
1018
|
this._align = align;
|
|
@@ -1290,7 +1111,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1290
1111
|
|
|
1291
1112
|
return renderer.render().then(() => {
|
|
1292
1113
|
// Done initializing & emit ready event
|
|
1293
|
-
this._plugins.forEach(
|
|
1114
|
+
this._plugins.forEach(plugin => plugin.init(this));
|
|
1294
1115
|
|
|
1295
1116
|
if (preventEventsBeforeInit) {
|
|
1296
1117
|
this.trigger = originalTrigger;
|
|
@@ -1312,7 +1133,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1312
1133
|
this._camera.destroy();
|
|
1313
1134
|
this._renderer.destroy();
|
|
1314
1135
|
|
|
1315
|
-
this._plugins.forEach(
|
|
1136
|
+
this._plugins.forEach(plugin => plugin.destroy());
|
|
1316
1137
|
|
|
1317
1138
|
this._initialized = false;
|
|
1318
1139
|
}
|
|
@@ -1351,11 +1172,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1351
1172
|
* @return {Promise<void>} A Promise which will be resolved after reaching the previous panel<ko>이전 패널 도달시에 resolve되는 Promise</ko>
|
|
1352
1173
|
*/
|
|
1353
1174
|
public prev(duration: number = this._duration): Promise<void> {
|
|
1354
|
-
return this.moveTo(
|
|
1355
|
-
this._control.activePanel?.prev()?.index ?? -1,
|
|
1356
|
-
duration,
|
|
1357
|
-
DIRECTION.PREV
|
|
1358
|
-
);
|
|
1175
|
+
return this.moveTo(this._control.activePanel?.prev()?.index ?? -1, duration, DIRECTION.PREV);
|
|
1359
1176
|
}
|
|
1360
1177
|
|
|
1361
1178
|
/**
|
|
@@ -1393,11 +1210,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1393
1210
|
* @return {Promise<void>} A Promise which will be resolved after reaching the next panel<ko>다음 패널 도달시에 resolve되는 Promise</ko>
|
|
1394
1211
|
*/
|
|
1395
1212
|
public next(duration: number = this._duration) {
|
|
1396
|
-
return this.moveTo(
|
|
1397
|
-
this._control.activePanel?.next()?.index ?? this._renderer.panelCount,
|
|
1398
|
-
duration,
|
|
1399
|
-
DIRECTION.NEXT
|
|
1400
|
-
);
|
|
1213
|
+
return this.moveTo(this._control.activePanel?.next()?.index ?? this._renderer.panelCount, duration, DIRECTION.NEXT);
|
|
1401
1214
|
}
|
|
1402
1215
|
|
|
1403
1216
|
/**
|
|
@@ -1436,32 +1249,18 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1436
1249
|
* </ko>
|
|
1437
1250
|
* @return {Promise<void>} A Promise which will be resolved after reaching the target panel<ko>해당 패널 도달시에 resolve되는 Promise</ko>
|
|
1438
1251
|
*/
|
|
1439
|
-
public moveTo(
|
|
1440
|
-
index: number,
|
|
1441
|
-
duration: number = this._duration,
|
|
1442
|
-
direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE
|
|
1443
|
-
) {
|
|
1252
|
+
public moveTo(index: number, duration: number = this._duration, direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE) {
|
|
1444
1253
|
const renderer = this._renderer;
|
|
1445
1254
|
const panelCount = renderer.panelCount;
|
|
1446
1255
|
|
|
1447
1256
|
const panel = renderer.getPanel(index);
|
|
1448
1257
|
|
|
1449
1258
|
if (!panel) {
|
|
1450
|
-
return Promise.reject(
|
|
1451
|
-
new FlickingError(
|
|
1452
|
-
ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
|
|
1453
|
-
ERROR.CODE.INDEX_OUT_OF_RANGE
|
|
1454
|
-
)
|
|
1455
|
-
);
|
|
1259
|
+
return Promise.reject(new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE));
|
|
1456
1260
|
}
|
|
1457
1261
|
|
|
1458
1262
|
if (this._control.animating) {
|
|
1459
|
-
return Promise.reject(
|
|
1460
|
-
new FlickingError(
|
|
1461
|
-
ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING,
|
|
1462
|
-
ERROR.CODE.ANIMATION_ALREADY_PLAYING
|
|
1463
|
-
)
|
|
1464
|
-
);
|
|
1263
|
+
return Promise.reject(new FlickingError(ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING, ERROR.CODE.ANIMATION_ALREADY_PLAYING));
|
|
1465
1264
|
}
|
|
1466
1265
|
|
|
1467
1266
|
if (this._control.holding) {
|
|
@@ -1470,7 +1269,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1470
1269
|
|
|
1471
1270
|
return this._control.moveToPanel(panel, {
|
|
1472
1271
|
duration,
|
|
1473
|
-
direction
|
|
1272
|
+
direction
|
|
1474
1273
|
});
|
|
1475
1274
|
}
|
|
1476
1275
|
|
|
@@ -1485,11 +1284,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1485
1284
|
* <ko>{@link ERROR_CODE INDEX_OUT_OF_RANGE} 해당 인덱스를 가진 패널이 존재하지 않을 경우</ko>
|
|
1486
1285
|
* @return {void}
|
|
1487
1286
|
*/
|
|
1488
|
-
public updateAnimation(
|
|
1489
|
-
index: number,
|
|
1490
|
-
duration?: number,
|
|
1491
|
-
direction?: ValueOf<typeof DIRECTION>
|
|
1492
|
-
): void {
|
|
1287
|
+
public updateAnimation(index: number, duration?: number, direction?: ValueOf<typeof DIRECTION>): void {
|
|
1493
1288
|
if (!this._control.animating) {
|
|
1494
1289
|
return;
|
|
1495
1290
|
}
|
|
@@ -1500,10 +1295,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1500
1295
|
const panel = renderer.getPanel(index);
|
|
1501
1296
|
|
|
1502
1297
|
if (!panel) {
|
|
1503
|
-
throw new FlickingError(
|
|
1504
|
-
ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
|
|
1505
|
-
ERROR.CODE.INDEX_OUT_OF_RANGE
|
|
1506
|
-
);
|
|
1298
|
+
throw new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE);
|
|
1507
1299
|
}
|
|
1508
1300
|
|
|
1509
1301
|
this._control.updateAnimation(panel, duration, direction);
|
|
@@ -1574,7 +1366,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1574
1366
|
index = true,
|
|
1575
1367
|
position = true,
|
|
1576
1368
|
includePanelHTML = false,
|
|
1577
|
-
visiblePanelsOnly = false
|
|
1369
|
+
visiblePanelsOnly = false
|
|
1578
1370
|
}: Partial<{
|
|
1579
1371
|
index: boolean;
|
|
1580
1372
|
position: boolean;
|
|
@@ -1585,7 +1377,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1585
1377
|
const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
|
|
1586
1378
|
|
|
1587
1379
|
const status: Status = {
|
|
1588
|
-
panels: panels.map(
|
|
1380
|
+
panels: panels.map(panel => {
|
|
1589
1381
|
const panelInfo: Status["panels"][0] = { index: panel.index };
|
|
1590
1382
|
|
|
1591
1383
|
if (includePanelHTML) {
|
|
@@ -1593,7 +1385,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1593
1385
|
}
|
|
1594
1386
|
|
|
1595
1387
|
return panelInfo;
|
|
1596
|
-
})
|
|
1388
|
+
})
|
|
1597
1389
|
};
|
|
1598
1390
|
|
|
1599
1391
|
if (index) {
|
|
@@ -1605,9 +1397,10 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1605
1397
|
if (nearestAnchor) {
|
|
1606
1398
|
status.position = {
|
|
1607
1399
|
panel: nearestAnchor.panel.index,
|
|
1608
|
-
progressInPanel: camera.getProgressInPanel(nearestAnchor.panel)
|
|
1400
|
+
progressInPanel: camera.getProgressInPanel(nearestAnchor.panel)
|
|
1609
1401
|
};
|
|
1610
1402
|
}
|
|
1403
|
+
|
|
1611
1404
|
}
|
|
1612
1405
|
|
|
1613
1406
|
if (visiblePanelsOnly) {
|
|
@@ -1627,43 +1420,40 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1627
1420
|
*/
|
|
1628
1421
|
public setStatus(status: Status): void {
|
|
1629
1422
|
if (!this._initialized) {
|
|
1630
|
-
throw new FlickingError(
|
|
1631
|
-
ERROR.MESSAGE.NOT_INITIALIZED,
|
|
1632
|
-
ERROR.CODE.NOT_INITIALIZED
|
|
1633
|
-
);
|
|
1423
|
+
throw new FlickingError(ERROR.MESSAGE.NOT_INITIALIZED, ERROR.CODE.NOT_INITIALIZED);
|
|
1634
1424
|
}
|
|
1635
1425
|
|
|
1636
|
-
const {
|
|
1426
|
+
const {
|
|
1427
|
+
index,
|
|
1428
|
+
position,
|
|
1429
|
+
visibleOffset,
|
|
1430
|
+
panels
|
|
1431
|
+
} = status;
|
|
1637
1432
|
|
|
1638
1433
|
const renderer = this._renderer;
|
|
1639
1434
|
const control = this._control;
|
|
1640
1435
|
|
|
1641
1436
|
// Can't add/remove panels on external rendering
|
|
1642
1437
|
if (panels[0]?.html && !this._renderExternal) {
|
|
1643
|
-
renderer.batchRemove({
|
|
1644
|
-
|
|
1645
|
-
deleteCount: this.panels.length,
|
|
1646
|
-
hasDOMInElements: true,
|
|
1647
|
-
});
|
|
1648
|
-
renderer.batchInsert({
|
|
1649
|
-
index: 0,
|
|
1650
|
-
elements: parseElement(panels.map((panel) => panel.html!)),
|
|
1651
|
-
hasDOMInElements: true,
|
|
1652
|
-
});
|
|
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 });
|
|
1653
1440
|
}
|
|
1654
1441
|
|
|
1655
1442
|
if (index != null) {
|
|
1656
|
-
const panelIndex = visibleOffset
|
|
1443
|
+
const panelIndex = visibleOffset
|
|
1444
|
+
? index - visibleOffset
|
|
1445
|
+
: index;
|
|
1657
1446
|
|
|
1658
1447
|
void this.moveTo(panelIndex, 0).catch(() => void 0);
|
|
1659
1448
|
}
|
|
1660
1449
|
|
|
1661
1450
|
if (position && this._moveType === MOVE_TYPE.FREE_SCROLL) {
|
|
1662
1451
|
const { panel, progressInPanel } = position;
|
|
1663
|
-
const panelIndex = visibleOffset
|
|
1452
|
+
const panelIndex = visibleOffset
|
|
1453
|
+
? panel - visibleOffset
|
|
1454
|
+
: panel;
|
|
1664
1455
|
const panelRange = renderer.panels[panelIndex].range;
|
|
1665
|
-
const newCameraPos =
|
|
1666
|
-
panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
|
|
1456
|
+
const newCameraPos = panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
|
|
1667
1457
|
|
|
1668
1458
|
void control.moveToPosition(newCameraPos, 0).catch(() => void 0);
|
|
1669
1459
|
}
|
|
@@ -1678,7 +1468,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1678
1468
|
*/
|
|
1679
1469
|
public addPlugins(...plugins: Plugin[]) {
|
|
1680
1470
|
if (this._initialized) {
|
|
1681
|
-
plugins.forEach(
|
|
1471
|
+
plugins.forEach(item => item.init(this));
|
|
1682
1472
|
}
|
|
1683
1473
|
|
|
1684
1474
|
this._plugins.push(...plugins);
|
|
@@ -1694,8 +1484,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1694
1484
|
* @see https://github.com/naver/egjs-flicking-plugins
|
|
1695
1485
|
*/
|
|
1696
1486
|
public removePlugins(...plugins: Plugin[]) {
|
|
1697
|
-
plugins.forEach(
|
|
1698
|
-
const foundIndex = findIndex(this._plugins,
|
|
1487
|
+
plugins.forEach(item => {
|
|
1488
|
+
const foundIndex = findIndex(this._plugins, val => val === item);
|
|
1699
1489
|
|
|
1700
1490
|
if (foundIndex >= 0) {
|
|
1701
1491
|
item.destroy();
|
|
@@ -1715,10 +1505,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1715
1505
|
* @return {this}
|
|
1716
1506
|
*/
|
|
1717
1507
|
public async resize(): Promise<void> {
|
|
1718
|
-
if (this._isResizing) return;
|
|
1719
|
-
|
|
1720
|
-
this._isResizing = true;
|
|
1721
|
-
|
|
1722
1508
|
const viewport = this._viewport;
|
|
1723
1509
|
const renderer = this._renderer;
|
|
1724
1510
|
const camera = this._camera;
|
|
@@ -1731,13 +1517,11 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1731
1517
|
? camera.getProgressInPanel(activePanel)
|
|
1732
1518
|
: 0;
|
|
1733
1519
|
|
|
1734
|
-
this.trigger(
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
})
|
|
1740
|
-
);
|
|
1520
|
+
this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
1521
|
+
width: prevWidth,
|
|
1522
|
+
height: prevHeight,
|
|
1523
|
+
element: viewport.element
|
|
1524
|
+
}));
|
|
1741
1525
|
|
|
1742
1526
|
viewport.resize();
|
|
1743
1527
|
await renderer.forceRenderAllPanels(); // Render all panel elements, to update sizes
|
|
@@ -1767,20 +1551,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1767
1551
|
const newHeight = viewport.height;
|
|
1768
1552
|
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
1769
1553
|
|
|
1770
|
-
this.trigger(
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
})
|
|
1781
|
-
);
|
|
1782
|
-
|
|
1783
|
-
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
|
+
}));
|
|
1784
1564
|
}
|
|
1785
1565
|
|
|
1786
1566
|
/**
|
|
@@ -1854,17 +1634,10 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1854
1634
|
*/
|
|
1855
1635
|
public insert(index: number, element: ElementLike | ElementLike[]): Panel[] {
|
|
1856
1636
|
if (this._renderExternal) {
|
|
1857
|
-
throw new FlickingError(
|
|
1858
|
-
ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
|
|
1859
|
-
ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
|
|
1860
|
-
);
|
|
1637
|
+
throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
|
|
1861
1638
|
}
|
|
1862
1639
|
|
|
1863
|
-
return this._renderer.batchInsert({
|
|
1864
|
-
index,
|
|
1865
|
-
elements: parseElement(element),
|
|
1866
|
-
hasDOMInElements: true,
|
|
1867
|
-
});
|
|
1640
|
+
return this._renderer.batchInsert({ index, elements: parseElement(element), hasDOMInElements: true });
|
|
1868
1641
|
}
|
|
1869
1642
|
|
|
1870
1643
|
/**
|
|
@@ -1878,34 +1651,26 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1878
1651
|
*/
|
|
1879
1652
|
public remove(index: number, deleteCount: number = 1): Panel[] {
|
|
1880
1653
|
if (this._renderExternal) {
|
|
1881
|
-
throw new FlickingError(
|
|
1882
|
-
ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
|
|
1883
|
-
ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
|
|
1884
|
-
);
|
|
1654
|
+
throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
|
|
1885
1655
|
}
|
|
1886
1656
|
|
|
1887
|
-
return this._renderer.batchRemove({
|
|
1888
|
-
index,
|
|
1889
|
-
deleteCount,
|
|
1890
|
-
hasDOMInElements: true,
|
|
1891
|
-
});
|
|
1657
|
+
return this._renderer.batchRemove({ index, deleteCount, hasDOMInElements: true });
|
|
1892
1658
|
}
|
|
1893
1659
|
|
|
1894
1660
|
private _createControl(): Control {
|
|
1895
1661
|
const moveType = this._moveType;
|
|
1896
|
-
const moveTypes = Object.keys(MOVE_TYPE).map(
|
|
1897
|
-
(key) => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>
|
|
1898
|
-
);
|
|
1662
|
+
const moveTypes = Object.keys(MOVE_TYPE).map(key => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>);
|
|
1899
1663
|
|
|
1900
|
-
const moveTypeStr = Array.isArray(moveType)
|
|
1664
|
+
const moveTypeStr = Array.isArray(moveType)
|
|
1665
|
+
? moveType[0]
|
|
1666
|
+
: moveType;
|
|
1901
1667
|
|
|
1902
|
-
const moveTypeOptions = Array.isArray(moveType)
|
|
1668
|
+
const moveTypeOptions = Array.isArray(moveType)
|
|
1669
|
+
? moveType[1] ?? {}
|
|
1670
|
+
: {};
|
|
1903
1671
|
|
|
1904
1672
|
if (!includes(moveTypes, moveTypeStr)) {
|
|
1905
|
-
throw new FlickingError(
|
|
1906
|
-
ERROR.MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
|
|
1907
|
-
ERROR.CODE.WRONG_OPTION
|
|
1908
|
-
);
|
|
1673
|
+
throw new FlickingError(ERROR.MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)), ERROR.CODE.WRONG_OPTION);
|
|
1909
1674
|
}
|
|
1910
1675
|
|
|
1911
1676
|
switch (moveTypeStr) {
|
|
@@ -1921,13 +1686,11 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1921
1686
|
private _createCamera(): Camera {
|
|
1922
1687
|
if (this._circular && this._bound) {
|
|
1923
1688
|
// eslint-disable-next-line no-console
|
|
1924
|
-
console.warn(
|
|
1925
|
-
'"circular" and "bound" option cannot be used together, ignoring bound.'
|
|
1926
|
-
);
|
|
1689
|
+
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
1927
1690
|
}
|
|
1928
1691
|
|
|
1929
1692
|
return new Camera(this, {
|
|
1930
|
-
align: this._align
|
|
1693
|
+
align: this._align
|
|
1931
1694
|
});
|
|
1932
1695
|
}
|
|
1933
1696
|
|
|
@@ -1935,22 +1698,23 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1935
1698
|
const externalRenderer = this._externalRenderer;
|
|
1936
1699
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
1937
1700
|
// eslint-disable-next-line no-console
|
|
1938
|
-
console.warn(
|
|
1939
|
-
'"virtual" and "panelsPerView" option should be used together, ignoring virtual.'
|
|
1940
|
-
);
|
|
1701
|
+
console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
|
|
1941
1702
|
}
|
|
1942
1703
|
|
|
1943
1704
|
return externalRenderer
|
|
1944
1705
|
? externalRenderer
|
|
1945
1706
|
: this._renderExternal
|
|
1946
|
-
|
|
1947
|
-
|
|
1707
|
+
? this._createExternalRenderer()
|
|
1708
|
+
: this._createVanillaRenderer();
|
|
1948
1709
|
}
|
|
1949
1710
|
|
|
1950
1711
|
private _createExternalRenderer(): ExternalRenderer {
|
|
1951
|
-
const {
|
|
1712
|
+
const {
|
|
1713
|
+
renderer,
|
|
1714
|
+
rendererOptions
|
|
1715
|
+
} = this._renderExternal!;
|
|
1952
1716
|
|
|
1953
|
-
return new renderer({ align: this._align, ...rendererOptions });
|
|
1717
|
+
return new (renderer)({ align: this._align, ...rendererOptions });
|
|
1954
1718
|
}
|
|
1955
1719
|
|
|
1956
1720
|
private _createVanillaRenderer(): VanillaRenderer {
|
|
@@ -1961,8 +1725,8 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1961
1725
|
strategy: virtual
|
|
1962
1726
|
? new VirtualRenderingStrategy()
|
|
1963
1727
|
: new NormalRenderingStrategy({
|
|
1964
|
-
|
|
1965
|
-
|
|
1728
|
+
providerCtor: VanillaElementProvider
|
|
1729
|
+
})
|
|
1966
1730
|
});
|
|
1967
1731
|
}
|
|
1968
1732
|
|
|
@@ -1970,25 +1734,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1970
1734
|
const renderer = this._renderer;
|
|
1971
1735
|
const control = this._control;
|
|
1972
1736
|
const camera = this._camera;
|
|
1973
|
-
const defaultPanel =
|
|
1974
|
-
renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
1737
|
+
const defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
1975
1738
|
|
|
1976
1739
|
if (!defaultPanel) return;
|
|
1977
1740
|
|
|
1978
1741
|
const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
|
|
1979
|
-
const initialPanel =
|
|
1980
|
-
nearestAnchor &&
|
|
1981
|
-
defaultPanel.position !== nearestAnchor.panel.position &&
|
|
1982
|
-
defaultPanel.index !== nearestAnchor.panel.index
|
|
1983
|
-
? nearestAnchor.panel
|
|
1984
|
-
: defaultPanel;
|
|
1742
|
+
const initialPanel = (nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index) ? nearestAnchor.panel : defaultPanel;
|
|
1985
1743
|
control.setActive(initialPanel, null, false);
|
|
1986
1744
|
|
|
1987
1745
|
if (!nearestAnchor) {
|
|
1988
|
-
throw new FlickingError(
|
|
1989
|
-
ERROR.MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position),
|
|
1990
|
-
ERROR.CODE.POSITION_NOT_REACHABLE
|
|
1991
|
-
);
|
|
1746
|
+
throw new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), ERROR.CODE.POSITION_NOT_REACHABLE);
|
|
1992
1747
|
}
|
|
1993
1748
|
|
|
1994
1749
|
let position = initialPanel.position;
|
|
@@ -2008,13 +1763,11 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2008
1763
|
const camera = this._camera;
|
|
2009
1764
|
const control = this._control;
|
|
2010
1765
|
|
|
2011
|
-
this.trigger(
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
})
|
|
2017
|
-
);
|
|
1766
|
+
this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
1767
|
+
width: 0,
|
|
1768
|
+
height: 0,
|
|
1769
|
+
element: viewport.element
|
|
1770
|
+
}));
|
|
2018
1771
|
|
|
2019
1772
|
viewport.resize();
|
|
2020
1773
|
renderer.updatePanelSize();
|
|
@@ -2028,18 +1781,16 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
2028
1781
|
const newHeight = viewport.height;
|
|
2029
1782
|
const sizeChanged = newWidth !== 0 || newHeight !== 0;
|
|
2030
1783
|
|
|
2031
|
-
this.trigger(
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
})
|
|
2042
|
-
);
|
|
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
|
+
}));
|
|
2043
1794
|
}
|
|
2044
1795
|
}
|
|
2045
1796
|
|