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