@egjs/flicking-plugins 4.8.0-beta.0 → 4.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declaration/AutoPlay.d.ts +5 -1
- package/dist/plugins.esm.js +18 -2
- package/dist/plugins.esm.js.map +1 -1
- package/dist/plugins.js +18 -2
- package/dist/plugins.js.map +1 -1
- package/dist/plugins.min.js +2 -2
- package/dist/plugins.min.js.map +1 -1
- package/package.json +1 -1
- package/src/AutoPlay.ts +10 -1
package/src/AutoPlay.ts
CHANGED
|
@@ -5,6 +5,7 @@ interface AutoPlayOptions {
|
|
|
5
5
|
animationDuration: number | undefined;
|
|
6
6
|
direction: typeof DIRECTION["NEXT"] | typeof DIRECTION["PREV"];
|
|
7
7
|
stopOnHover: boolean;
|
|
8
|
+
stopOnInit: boolean;
|
|
8
9
|
delayAfterHover: number;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -19,6 +20,7 @@ class AutoPlay implements Plugin {
|
|
|
19
20
|
private _animationDuration: AutoPlayOptions["animationDuration"];
|
|
20
21
|
private _direction: AutoPlayOptions["direction"];
|
|
21
22
|
private _stopOnHover: AutoPlayOptions["stopOnHover"];
|
|
23
|
+
private _stopOnInit: AutoPlayOptions["stopOnInit"];
|
|
22
24
|
private _delayAfterHover: AutoPlayOptions["delayAfterHover"];
|
|
23
25
|
|
|
24
26
|
/* Internal Values */
|
|
@@ -31,6 +33,7 @@ class AutoPlay implements Plugin {
|
|
|
31
33
|
public get animationDuration() { return this._animationDuration; }
|
|
32
34
|
public get direction() { return this._direction; }
|
|
33
35
|
public get stopOnHover() { return this._stopOnHover; }
|
|
36
|
+
public get stopOnInit() { return this._stopOnInit; }
|
|
34
37
|
public get delayAfterHover() { return this._delayAfterHover; }
|
|
35
38
|
public get playing() { return this._playing; }
|
|
36
39
|
|
|
@@ -38,6 +41,7 @@ class AutoPlay implements Plugin {
|
|
|
38
41
|
public set animationDuration(val: number | undefined) { this._animationDuration = val; }
|
|
39
42
|
public set direction(val: AutoPlayOptions["direction"]) { this._direction = val; }
|
|
40
43
|
public set stopOnHover(val: boolean) { this._stopOnHover = val; }
|
|
44
|
+
public set stopOnInit(val: boolean) { this._stopOnInit = val; }
|
|
41
45
|
public set delayAfterHover(val: number) { this._delayAfterHover = val; }
|
|
42
46
|
|
|
43
47
|
/**
|
|
@@ -46,6 +50,7 @@ class AutoPlay implements Plugin {
|
|
|
46
50
|
* @param {number | undefined} options.animationDuration Duration of animation of moving to the next panel. If undefined, duration option of the Flicking instance is used instead.<ko>패널이 움직이는 애니메이션의 지속 시간, undefined라면 Flicking 인스턴스의 duration 값을 사용한다</ko>
|
|
47
51
|
* @param {"PREV" | "NEXT"} options.direction The direction in which the panel moves.<ko>패널이 움직이는 방향</ko>
|
|
48
52
|
* @param {boolean} options.stopOnHover Whether to stop when mouse hover upon the element.<ko>엘리먼트에 마우스를 올렸을 때 AutoPlay를 정지할지 여부</ko>
|
|
53
|
+
* @param {boolean} options.stopOnInit Whether to stop when mouse hover upon the element.<ko>엘리먼트에 마우스를 올렸을 때 AutoPlay를 정지할지 여부</ko>
|
|
49
54
|
* @param {number} options.delayAfterHover If stopOnHover is true, the amount of time to wait before moving on to the next panel when mouse leaves the element.<ko>stopOnHover를 사용한다면 마우스가 엘리먼트로부터 나간 뒤 다음 패널로 움직이기까지 대기 시간</ko>
|
|
50
55
|
* @example
|
|
51
56
|
* ```ts
|
|
@@ -57,12 +62,14 @@ class AutoPlay implements Plugin {
|
|
|
57
62
|
animationDuration = undefined,
|
|
58
63
|
direction = DIRECTION.NEXT,
|
|
59
64
|
stopOnHover = false,
|
|
65
|
+
stopOnInit = false,
|
|
60
66
|
delayAfterHover
|
|
61
67
|
}: Partial<AutoPlayOptions> = {}) {
|
|
62
68
|
this._duration = duration;
|
|
63
69
|
this._animationDuration = animationDuration;
|
|
64
70
|
this._direction = direction;
|
|
65
71
|
this._stopOnHover = stopOnHover;
|
|
72
|
+
this._stopOnInit = stopOnInit;
|
|
66
73
|
this._delayAfterHover = delayAfterHover ?? duration;
|
|
67
74
|
}
|
|
68
75
|
|
|
@@ -85,7 +92,9 @@ class AutoPlay implements Plugin {
|
|
|
85
92
|
targetEl.addEventListener("mouseleave", this._onMouseLeave, false);
|
|
86
93
|
}
|
|
87
94
|
|
|
88
|
-
this.
|
|
95
|
+
if (!this._stopOnInit) {
|
|
96
|
+
this.play();
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
public destroy(): void {
|