@egjs/flicking 4.15.0 → 4.16.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/README.md +6 -175
- package/{declaration → dist}/CrossFlicking.d.ts +7 -2
- package/dist/Flicking.d.ts +1231 -0
- package/dist/camera/Camera.d.ts +324 -0
- package/{declaration → dist}/camera/mode/BoundCameraMode.d.ts +5 -4
- package/{declaration → dist}/camera/mode/CameraMode.d.ts +7 -6
- package/{declaration → dist}/camera/mode/CircularCameraMode.d.ts +9 -5
- package/{declaration → dist}/camera/mode/LinearCameraMode.d.ts +2 -4
- package/{declaration → dist}/cfc/getDefaultCameraTransform.d.ts +1 -1
- package/dist/cfc/withFlickingMethods.d.ts +15 -0
- package/{declaration/const/axes.d.ts → dist/constants/internal.d.ts} +8 -0
- package/dist/constants/values.d.ts +67 -0
- package/dist/control/AxesController.d.ts +186 -0
- package/dist/control/Control.d.ts +185 -0
- package/dist/control/FreeControl.d.ts +44 -0
- package/dist/control/SnapControl.d.ts +54 -0
- package/{declaration → dist}/control/StateMachine.d.ts +3 -0
- package/dist/control/StrictControl.d.ts +60 -0
- package/{declaration → dist}/control/states/AnimatingState.d.ts +12 -0
- package/{declaration → dist}/control/states/DisabledState.d.ts +12 -0
- package/{declaration → dist}/control/states/DraggingState.d.ts +12 -0
- package/{declaration → dist}/control/states/HoldingState.d.ts +12 -0
- package/{declaration → dist}/control/states/IdleState.d.ts +12 -0
- package/dist/control/states/State.d.ts +86 -0
- package/dist/core/AnchorPoint.d.ts +40 -0
- package/{declaration → dist}/core/AutoResizer.d.ts +6 -0
- package/dist/core/Viewport.d.ts +60 -0
- package/dist/core/VirtualManager.d.ts +84 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/panel/Panel.d.ts +298 -0
- package/dist/core/panel/VirtualPanel.d.ts +41 -0
- package/dist/core/panel/index.d.ts +5 -0
- package/{declaration → dist}/core/panel/provider/VanillaElementProvider.d.ts +3 -0
- package/{declaration → dist}/core/panel/provider/VirtualElementProvider.d.ts +3 -0
- package/dist/error/FlickingError.d.ts +25 -0
- package/dist/error/codes.d.ts +79 -0
- package/dist/error/groups.d.ts +94 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/types.d.ts +516 -0
- package/dist/event/groups.d.ts +40 -0
- package/dist/event/index.d.ts +3 -0
- package/dist/event/names.d.ts +47 -0
- package/dist/event/types.d.ts +318 -0
- package/dist/flicking.cjs.js +5559 -7791
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +5637 -7699
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +6722 -8893
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +1 -9
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +9661 -14086
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +1 -9
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/reactive/index.d.ts +126 -0
- package/{declaration → dist}/renderer/ExternalRenderer.d.ts +3 -0
- package/dist/renderer/Renderer.d.ts +215 -0
- package/{declaration → dist}/renderer/VanillaRenderer.d.ts +6 -0
- package/{declaration → dist}/renderer/strategy/NormalRenderingStrategy.d.ts +5 -2
- package/{declaration → dist}/renderer/strategy/RenderingStrategy.d.ts +4 -1
- package/dist/types/external.d.ts +58 -0
- package/dist/types/params.d.ts +10 -0
- package/{declaration → dist}/utils.d.ts +7 -7
- package/package.json +35 -162
- package/src/CrossFlicking.ts +68 -96
- package/src/Flicking.ts +1051 -972
- package/src/camera/Camera.ts +217 -206
- package/src/camera/index.ts +2 -6
- package/src/camera/mode/BoundCameraMode.ts +38 -27
- package/src/camera/mode/CameraMode.ts +14 -12
- package/src/camera/mode/CircularCameraMode.ts +24 -16
- package/src/camera/mode/LinearCameraMode.ts +3 -1
- package/src/camera/mode/index.ts +4 -10
- package/src/cfc/getDefaultCameraTransform.ts +9 -11
- package/src/cfc/getRenderingPanels.ts +2 -4
- package/src/cfc/index.ts +4 -9
- package/src/cfc/sync.ts +11 -5
- package/src/cfc/withFlickingMethods.ts +6 -7
- package/src/{const/axes.ts → constants/internal.ts} +1 -0
- package/src/constants/values.ts +78 -0
- package/src/control/AxesController.ts +119 -110
- package/src/control/Control.ts +147 -180
- package/src/control/FreeControl.ts +36 -60
- package/src/control/SnapControl.ts +64 -68
- package/src/control/StateMachine.ts +14 -11
- package/src/control/StrictControl.ts +58 -73
- package/src/control/index.ts +9 -12
- package/src/control/states/AnimatingState.ts +8 -11
- package/src/control/states/DisabledState.ts +0 -5
- package/src/control/states/DraggingState.ts +8 -12
- package/src/control/states/HoldingState.ts +10 -15
- package/src/control/states/IdleState.ts +1 -6
- package/src/control/states/State.ts +46 -85
- package/src/core/AnchorPoint.ts +25 -23
- package/src/core/AutoResizer.ts +6 -15
- package/src/core/ResizeWatcher.ts +17 -16
- package/src/core/Viewport.ts +35 -46
- package/src/core/VirtualManager.ts +48 -36
- package/src/core/index.ts +6 -9
- package/src/core/panel/Panel.ts +190 -185
- package/src/core/panel/VirtualPanel.ts +17 -21
- package/src/core/panel/index.ts +4 -9
- package/src/core/panel/provider/VanillaElementProvider.ts +6 -2
- package/src/core/panel/provider/VirtualElementProvider.ts +6 -2
- package/src/core/panel/provider/index.ts +2 -7
- package/src/{core → error}/FlickingError.ts +5 -7
- package/src/error/codes.ts +164 -0
- package/src/error/groups.ts +124 -0
- package/src/error/index.ts +9 -0
- package/src/error/types.ts +535 -0
- package/src/event/groups.ts +61 -0
- package/src/event/index.ts +8 -0
- package/src/event/names.ts +52 -0
- package/src/event/types.ts +355 -0
- package/src/index.ts +9 -11
- package/src/index.umd.ts +9 -3
- package/src/reactive/index.ts +39 -74
- package/src/renderer/Renderer.ts +170 -115
- package/src/renderer/VanillaRenderer.ts +12 -9
- package/src/renderer/index.ts +4 -9
- package/src/renderer/strategy/NormalRenderingStrategy.ts +26 -22
- package/src/renderer/strategy/RenderingStrategy.ts +2 -1
- package/src/renderer/strategy/VirtualRenderingStrategy.ts +20 -13
- package/src/renderer/strategy/index.ts +4 -9
- package/src/types/external.ts +72 -0
- package/src/{type → types}/internal.ts +2 -5
- package/src/types/params.ts +15 -0
- package/src/utils.ts +37 -32
- package/CONTRIBUTING.md +0 -59
- package/NOTICE +0 -31
- package/core-packages-link.js +0 -75
- package/debug/reactive/index.html +0 -240
- package/declaration/Flicking.d.ts +0 -264
- package/declaration/camera/Camera.d.ts +0 -90
- package/declaration/cfc/withFlickingMethods.d.ts +0 -2
- package/declaration/const/error.d.ts +0 -34
- package/declaration/const/external.d.ts +0 -54
- package/declaration/control/AxesController.d.ts +0 -45
- package/declaration/control/Control.d.ts +0 -45
- package/declaration/control/FreeControl.d.ts +0 -14
- package/declaration/control/SnapControl.d.ts +0 -16
- package/declaration/control/StrictControl.d.ts +0 -20
- package/declaration/control/states/State.d.ts +0 -47
- package/declaration/core/AnchorPoint.d.ts +0 -15
- package/declaration/core/FlickingError.d.ts +0 -5
- package/declaration/core/Viewport.d.ts +0 -25
- package/declaration/core/VirtualManager.d.ts +0 -37
- package/declaration/core/index.d.ts +0 -6
- package/declaration/core/panel/Panel.d.ts +0 -89
- package/declaration/core/panel/VirtualPanel.d.ts +0 -19
- package/declaration/core/panel/index.d.ts +0 -5
- package/declaration/index.d.ts +0 -16
- package/declaration/reactive/index.d.ts +0 -25
- package/declaration/renderer/Renderer.d.ts +0 -60
- package/declaration/type/event.d.ts +0 -88
- package/declaration/type/external.d.ts +0 -31
- package/jsconfig.json +0 -5
- package/jsdoc-to-mdx.json +0 -7
- package/rollup.config.demo.js +0 -24
- package/rollup.config.dev.js +0 -12
- package/rollup.config.js +0 -57
- package/src/const/error.ts +0 -64
- package/src/const/external.ts +0 -138
- package/src/type/event.ts +0 -315
- package/src/type/external.ts +0 -78
- package/tsconfig.declaration.json +0 -17
- package/tsconfig.eslint.json +0 -10
- package/tsconfig.json +0 -23
- package/{declaration → dist}/camera/index.d.ts +0 -0
- package/{declaration → dist}/camera/mode/index.d.ts +2 -2
- package/{declaration → dist}/cfc/getRenderingPanels.d.ts +0 -0
- package/{declaration → dist}/cfc/index.d.ts +3 -3
- package/{declaration → dist}/cfc/sync.d.ts +0 -0
- package/{declaration → dist}/control/index.d.ts +7 -7
- package/{declaration → dist}/core/ResizeWatcher.d.ts +0 -0
- package/{declaration → dist}/core/panel/provider/ElementProvider.d.ts +0 -0
- package/{declaration → dist}/core/panel/provider/index.d.ts +0 -0
- package/{declaration → dist}/index.cjs.d.ts +0 -0
- package/{declaration → dist}/index.umd.d.ts +0 -0
- package/{declaration → dist}/renderer/index.d.ts +1 -1
- package/{declaration → dist}/renderer/strategy/VirtualRenderingStrategy.d.ts +1 -1
- package/{declaration → dist}/renderer/strategy/index.d.ts +1 -1
- /package/{declaration/type → dist/types}/internal.d.ts +0 -0
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
* Copyright (c) 2015 NAVER Corp.
|
|
3
3
|
* egjs projects are licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import Axes, {
|
|
6
|
-
|
|
5
|
+
import Axes, { AxesEvents, OnRelease, PanInput } from "@egjs/axes";
|
|
6
|
+
import * as AXES from "../constants/internal";
|
|
7
|
+
import { ORDER } from "../constants/values";
|
|
8
|
+
import * as ERROR from "../error/codes";
|
|
9
|
+
import FlickingError from "../error/FlickingError";
|
|
7
10
|
import Flicking from "../Flicking";
|
|
8
|
-
import
|
|
9
|
-
import * as AXES from "../const/axes";
|
|
10
|
-
import * as ERROR from "../const/error";
|
|
11
|
-
import { ORDER } from "../const/external";
|
|
11
|
+
import { ControlParams } from "../types/external";
|
|
12
12
|
import { getFlickingAttached, parseBounce } from "../utils";
|
|
13
|
-
import { ControlParams } from "../type/external";
|
|
14
13
|
|
|
15
14
|
import StateMachine from "./StateMachine";
|
|
15
|
+
import State from "./states/State";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* A controller that handles the {@link https://naver.github.io/egjs-axes/ @egjs/axes} events
|
|
19
|
-
* @ko {@link https://naver.github.io/egjs-axes/ @egjs/axes}의 이벤트를 처리하는 컨트롤러 컴포넌트
|
|
18
|
+
* A controller that handles the {@link https://naver.github.io/egjs-axes/ | @egjs/axes} events
|
|
20
19
|
* @internal
|
|
21
20
|
*/
|
|
22
21
|
class AxesController {
|
|
@@ -29,45 +28,42 @@ class AxesController {
|
|
|
29
28
|
private _dragged: boolean;
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
|
-
* An {@link https://naver.github.io/egjs-axes/docs/api/Axes Axes} instance
|
|
33
|
-
* @ko {@link https://naver.github.io/egjs-axes/docs/api/Axes Axes}의 인스턴스
|
|
34
|
-
* @type {Axes | null}
|
|
31
|
+
* An {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
35
32
|
* @see https://naver.github.io/egjs-axes/docs/api/Axes
|
|
36
33
|
* @readonly
|
|
37
34
|
*/
|
|
38
|
-
public get axes()
|
|
35
|
+
public get axes(): Axes | null {
|
|
36
|
+
return this._axes;
|
|
37
|
+
}
|
|
39
38
|
/**
|
|
40
|
-
* An {@link https://naver.github.io/egjs-axes/docs/api/PanInput PanInput} instance
|
|
41
|
-
* @ko {@link https://naver.github.io/egjs-axes/docs/api/PanInput PanInput}의 인스턴스
|
|
42
|
-
* @type {PanInput | null}
|
|
39
|
+
* An {@link https://naver.github.io/egjs-axes/docs/api/PanInput | PanInput} instance
|
|
43
40
|
* @see https://naver.github.io/egjs-axes/docs/api/PanInput
|
|
44
41
|
* @readonly
|
|
45
42
|
*/
|
|
46
|
-
public get panInput()
|
|
43
|
+
public get panInput(): PanInput | null {
|
|
44
|
+
return this._panInput;
|
|
45
|
+
}
|
|
47
46
|
/**
|
|
48
47
|
* @internal
|
|
49
48
|
*/
|
|
50
|
-
public get stateMachine() {
|
|
49
|
+
public get stateMachine(): StateMachine {
|
|
50
|
+
return this._stateMachine;
|
|
51
|
+
}
|
|
51
52
|
/**
|
|
52
53
|
* A activated {@link State} that shows the current status of the user input or the animation
|
|
53
|
-
* @ko 현재 활성화된 {@link State} 인스턴스로 사용자 입력 또는 애니메이션 상태를 나타냅니다
|
|
54
|
-
* @type {State}
|
|
55
54
|
*/
|
|
56
|
-
public get state() {
|
|
55
|
+
public get state(): State {
|
|
56
|
+
return this._stateMachine.state;
|
|
57
|
+
}
|
|
57
58
|
/**
|
|
58
59
|
* A context of the current animation playing
|
|
59
|
-
* @ko 현재 재생중인 애니메이션 정보
|
|
60
|
-
* @type {object}
|
|
61
|
-
* @property {number} start A start position of the animation<ko>애니메이션 시작 지점</ko>
|
|
62
|
-
* @property {number} end A end position of the animation<ko>애니메이션 끝 지점</ko>
|
|
63
|
-
* @property {number} offset camera offset<ko>카메라 오프셋</ko>
|
|
64
60
|
* @readonly
|
|
65
61
|
*/
|
|
66
|
-
public get animatingContext() {
|
|
62
|
+
public get animatingContext(): { start: number; end: number; offset: number } {
|
|
63
|
+
return this._animatingContext;
|
|
64
|
+
}
|
|
67
65
|
/**
|
|
68
66
|
* A current control parameters of the Axes instance
|
|
69
|
-
* @ko 활성화된 현재 Axes 패러미터들
|
|
70
|
-
* @type {ControlParams}
|
|
71
67
|
*/
|
|
72
68
|
public get controlParams(): ControlParams {
|
|
73
69
|
const axes = this._axes;
|
|
@@ -91,34 +87,33 @@ class AxesController {
|
|
|
91
87
|
|
|
92
88
|
/**
|
|
93
89
|
* A Boolean indicating whether the user input is enabled
|
|
94
|
-
* @ko 현재 사용자 입력이 활성화되었는지를 나타내는 값
|
|
95
|
-
* @type {boolean}
|
|
96
90
|
* @readonly
|
|
97
91
|
*/
|
|
98
|
-
public get enabled() {
|
|
92
|
+
public get enabled(): boolean {
|
|
93
|
+
return this._panInput?.isEnabled() ?? false;
|
|
94
|
+
}
|
|
99
95
|
/**
|
|
100
|
-
* Current position value in {@link https://naver.github.io/egjs-axes/
|
|
101
|
-
* @ko {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html Axes} 인스턴스 내부의 현재 좌표 값
|
|
102
|
-
* @type {number}
|
|
96
|
+
* Current position value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
103
97
|
* @readonly
|
|
104
98
|
*/
|
|
105
|
-
public get position() {
|
|
99
|
+
public get position(): number {
|
|
100
|
+
return this._axes?.get([AXES.POSITION_KEY])[AXES.POSITION_KEY] ?? 0;
|
|
101
|
+
}
|
|
106
102
|
/**
|
|
107
|
-
* Current range value in {@link https://naver.github.io/egjs-axes/
|
|
108
|
-
* @ko {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html Axes} 인스턴스 내부의 현재 이동 범위 값
|
|
109
|
-
* @type {number[]}
|
|
103
|
+
* Current range value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
110
104
|
* @readonly
|
|
111
105
|
*/
|
|
112
|
-
public get range()
|
|
106
|
+
public get range(): number[] {
|
|
107
|
+
return this._axes?.axis[AXES.POSITION_KEY].range ?? [0, 0];
|
|
108
|
+
}
|
|
113
109
|
/**
|
|
114
110
|
* Actual bounce size(px)
|
|
115
|
-
* @ko 적용된 bounce 크기(px 단위)
|
|
116
|
-
* @type {number[]}
|
|
117
111
|
* @readonly
|
|
118
112
|
*/
|
|
119
|
-
public get bounce()
|
|
113
|
+
public get bounce(): number[] | undefined {
|
|
114
|
+
return this._axes?.axis[AXES.POSITION_KEY].bounce as number[] | undefined;
|
|
115
|
+
}
|
|
120
116
|
|
|
121
|
-
/** */
|
|
122
117
|
public constructor() {
|
|
123
118
|
this._resetInternalValues();
|
|
124
119
|
this._stateMachine = new StateMachine();
|
|
@@ -126,26 +121,29 @@ class AxesController {
|
|
|
126
121
|
|
|
127
122
|
/**
|
|
128
123
|
* Initialize AxesController
|
|
129
|
-
* @
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
124
|
+
* @remarks
|
|
125
|
+
* This method creates and configures the Axes and PanInput instances.
|
|
126
|
+
* @param flicking - An instance of {@link Flicking}
|
|
127
|
+
* @returns The current instance for method chaining
|
|
133
128
|
*/
|
|
134
129
|
public init(flicking: Flicking): this {
|
|
135
130
|
this._flicking = flicking;
|
|
136
131
|
|
|
137
|
-
this._axes = new Axes(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
this._axes = new Axes(
|
|
133
|
+
{
|
|
134
|
+
[AXES.POSITION_KEY]: {
|
|
135
|
+
range: [0, 0],
|
|
136
|
+
circular: false,
|
|
137
|
+
bounce: [0, 0]
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
deceleration: flicking.deceleration,
|
|
142
|
+
interruptable: flicking.interruptable,
|
|
143
|
+
nested: flicking.nested,
|
|
144
|
+
easing: flicking.easing
|
|
142
145
|
}
|
|
143
|
-
|
|
144
|
-
deceleration: flicking.deceleration,
|
|
145
|
-
interruptable: flicking.interruptable,
|
|
146
|
-
nested: flicking.nested,
|
|
147
|
-
easing: flicking.easing
|
|
148
|
-
});
|
|
146
|
+
);
|
|
149
147
|
this._panInput = new PanInput(flicking.viewport.element, {
|
|
150
148
|
inputType: flicking.inputType,
|
|
151
149
|
threshold: flicking.dragThreshold,
|
|
@@ -175,8 +173,8 @@ class AxesController {
|
|
|
175
173
|
|
|
176
174
|
/**
|
|
177
175
|
* Destroy AxesController and return to initial state
|
|
178
|
-
* @
|
|
179
|
-
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* This method destroys the Axes and PanInput instances and removes all event handlers.
|
|
180
178
|
*/
|
|
181
179
|
public destroy(): void {
|
|
182
180
|
if (this._axes) {
|
|
@@ -191,9 +189,9 @@ class AxesController {
|
|
|
191
189
|
|
|
192
190
|
/**
|
|
193
191
|
* Enable input from the user (mouse/touch)
|
|
194
|
-
* @
|
|
195
|
-
*
|
|
196
|
-
* @
|
|
192
|
+
* @remarks
|
|
193
|
+
* Enables the PanInput to receive user interactions.
|
|
194
|
+
* @returns The current instance for method chaining
|
|
197
195
|
*/
|
|
198
196
|
public enable(): this {
|
|
199
197
|
this._panInput?.enable();
|
|
@@ -203,9 +201,9 @@ class AxesController {
|
|
|
203
201
|
|
|
204
202
|
/**
|
|
205
203
|
* Disable input from the user (mouse/touch)
|
|
206
|
-
* @
|
|
207
|
-
*
|
|
208
|
-
* @
|
|
204
|
+
* @remarks
|
|
205
|
+
* Disables the PanInput to ignore user interactions.
|
|
206
|
+
* @returns The current instance for method chaining
|
|
209
207
|
*/
|
|
210
208
|
public disable(): this {
|
|
211
209
|
this._panInput?.disable();
|
|
@@ -215,9 +213,9 @@ class AxesController {
|
|
|
215
213
|
|
|
216
214
|
/**
|
|
217
215
|
* Releases ongoing user input (mouse/touch)
|
|
218
|
-
* @
|
|
219
|
-
*
|
|
220
|
-
* @
|
|
216
|
+
* @remarks
|
|
217
|
+
* Immediately releases the PanInput, simulating the user lifting their finger.
|
|
218
|
+
* @returns The current instance for method chaining
|
|
221
219
|
*/
|
|
222
220
|
public release(): this {
|
|
223
221
|
this._panInput?.release();
|
|
@@ -227,11 +225,11 @@ class AxesController {
|
|
|
227
225
|
|
|
228
226
|
/**
|
|
229
227
|
* Change the destination and duration of the animation currently playing
|
|
230
|
-
* @
|
|
231
|
-
*
|
|
232
|
-
* @param
|
|
233
|
-
* @
|
|
234
|
-
* @
|
|
228
|
+
* @remarks
|
|
229
|
+
* This method updates the Axes animation target position and optionally the duration.
|
|
230
|
+
* @param position - A position to move
|
|
231
|
+
* @param duration - Duration of the animation (unit: ms)
|
|
232
|
+
* @returns The current instance for method chaining
|
|
235
233
|
*/
|
|
236
234
|
public updateAnimation(position: number, duration?: number): this {
|
|
237
235
|
this._animatingContext = {
|
|
@@ -248,9 +246,9 @@ class AxesController {
|
|
|
248
246
|
|
|
249
247
|
/**
|
|
250
248
|
* Stops the animation currently playing
|
|
251
|
-
* @
|
|
252
|
-
*
|
|
253
|
-
* @
|
|
249
|
+
* @remarks
|
|
250
|
+
* This method immediately stops the Axes animation at the current position.
|
|
251
|
+
* @returns The current instance for method chaining
|
|
254
252
|
*/
|
|
255
253
|
public stopAnimation(): this {
|
|
256
254
|
this._axes?.stopAnimation();
|
|
@@ -259,13 +257,12 @@ class AxesController {
|
|
|
259
257
|
}
|
|
260
258
|
|
|
261
259
|
/**
|
|
262
|
-
* Update {@link https://naver.github.io/egjs-axes/ @egjs/axes}'s state
|
|
263
|
-
* @
|
|
264
|
-
*
|
|
265
|
-
* @
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* @return {this}
|
|
260
|
+
* Update {@link https://naver.github.io/egjs-axes/ | @egjs/axes}'s state
|
|
261
|
+
* @remarks
|
|
262
|
+
* This method synchronizes the Axes state with the given control parameters.
|
|
263
|
+
* @param controlParams - Control parameters
|
|
264
|
+
* @throws {@link InitializationErrors}
|
|
265
|
+
* @returns The current instance for method chaining
|
|
269
266
|
*/
|
|
270
267
|
public update(controlParams: ControlParams): this {
|
|
271
268
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -284,8 +281,9 @@ class AxesController {
|
|
|
284
281
|
|
|
285
282
|
/**
|
|
286
283
|
* Attach a handler to the camera element to prevent click events during animation
|
|
287
|
-
* @
|
|
288
|
-
* @
|
|
284
|
+
* @remarks
|
|
285
|
+
* This is used when {@link FlickingOptions.preventClickOnDrag | preventClickOnDrag} is enabled.
|
|
286
|
+
* @returns The current instance for method chaining
|
|
289
287
|
*/
|
|
290
288
|
public addPreventClickHandler(): this {
|
|
291
289
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -301,8 +299,9 @@ class AxesController {
|
|
|
301
299
|
|
|
302
300
|
/**
|
|
303
301
|
* Detach a handler to the camera element to prevent click events during animation
|
|
304
|
-
* @
|
|
305
|
-
* @
|
|
302
|
+
* @remarks
|
|
303
|
+
* This is used when {@link FlickingOptions.preventClickOnDrag | preventClickOnDrag} is disabled.
|
|
304
|
+
* @returns The current instance for method chaining
|
|
306
305
|
*/
|
|
307
306
|
public removePreventClickHandler(): this {
|
|
308
307
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -317,32 +316,23 @@ class AxesController {
|
|
|
317
316
|
}
|
|
318
317
|
|
|
319
318
|
/**
|
|
320
|
-
* Run Axes's {@link https://naver.github.io/egjs-axes/
|
|
321
|
-
* @
|
|
322
|
-
*
|
|
323
|
-
* @param
|
|
324
|
-
* @param
|
|
325
|
-
* @
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* |{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING}|When {@link Control#init init} is not called before|
|
|
329
|
-
* |{@link ERROR_CODE ANIMATION_INTERRUPTED}|When the animation is interrupted by user input|
|
|
330
|
-
* <ko>
|
|
331
|
-
*
|
|
332
|
-
* |code|condition|
|
|
333
|
-
* |---|---|
|
|
334
|
-
* |{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING}|{@link Control#init init}이 이전에 호출되지 않은 경우|
|
|
335
|
-
* |{@link ERROR_CODE ANIMATION_INTERRUPTED}|사용자 입력에 의해 애니메이션이 중단된 경우|
|
|
336
|
-
*
|
|
337
|
-
* </ko>
|
|
338
|
-
* @return {Promise<void>} A Promise which will be resolved after reaching the target position<ko>해당 좌표 도달시에 resolve되는 Promise</ko>
|
|
319
|
+
* Run Axes's {@link https://naver.github.io/egjs-axes/docs/api/Axes#setTo | setTo} using the given position
|
|
320
|
+
* @remarks
|
|
321
|
+
* If the target position equals the current position, the promise resolves immediately without animation.
|
|
322
|
+
* @param position - A position to move
|
|
323
|
+
* @param duration - Duration of the animation (unit: ms)
|
|
324
|
+
* @param axesEvent - If provided, it'll use its {@link https://naver.github.io/egjs-axes/docs/api/Axes#setTo | setTo} method instead
|
|
325
|
+
* @throws {@link MovementErrors}
|
|
326
|
+
* @returns A Promise which will be resolved after reaching the target position
|
|
339
327
|
*/
|
|
340
328
|
public animateTo(position: number, duration: number, axesEvent?: OnRelease): Promise<void> {
|
|
341
329
|
const axes = this._axes;
|
|
342
330
|
const state = this._stateMachine.state;
|
|
343
331
|
|
|
344
332
|
if (!axes) {
|
|
345
|
-
return Promise.reject(
|
|
333
|
+
return Promise.reject(
|
|
334
|
+
new FlickingError(ERROR.MESSAGE.NOT_ATTACHED_TO_FLICKING, ERROR.CODE.NOT_ATTACHED_TO_FLICKING)
|
|
335
|
+
);
|
|
346
336
|
}
|
|
347
337
|
|
|
348
338
|
const startPos = this.getCurrentPosition();
|
|
@@ -398,7 +388,6 @@ class AxesController {
|
|
|
398
388
|
|
|
399
389
|
/**
|
|
400
390
|
* Returns the current axes position
|
|
401
|
-
* @ko 현재 axes의 position을 반환합니다.
|
|
402
391
|
*/
|
|
403
392
|
public getCurrentPosition() {
|
|
404
393
|
return this._axes?.get([AXES.POSITION_KEY])[AXES.POSITION_KEY] ?? 0;
|
|
@@ -415,6 +404,11 @@ class AxesController {
|
|
|
415
404
|
panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
|
|
416
405
|
}
|
|
417
406
|
|
|
407
|
+
/**
|
|
408
|
+
* @internal
|
|
409
|
+
* @privateRemarks
|
|
410
|
+
* Resets all internal values to their defaults. Called during construction and destruction.
|
|
411
|
+
*/
|
|
418
412
|
private _resetInternalValues() {
|
|
419
413
|
this._flicking = null;
|
|
420
414
|
this._axes = null;
|
|
@@ -423,14 +417,29 @@ class AxesController {
|
|
|
423
417
|
this._dragged = false;
|
|
424
418
|
}
|
|
425
419
|
|
|
420
|
+
/**
|
|
421
|
+
* @internal
|
|
422
|
+
* @privateRemarks
|
|
423
|
+
* Handles the Axes hold event to reset the dragged state.
|
|
424
|
+
*/
|
|
426
425
|
private _onAxesHold = () => {
|
|
427
426
|
this._dragged = false;
|
|
428
427
|
};
|
|
429
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @internal
|
|
431
|
+
* @privateRemarks
|
|
432
|
+
* Handles the Axes change event to update the dragged state.
|
|
433
|
+
*/
|
|
430
434
|
private _onAxesChange = () => {
|
|
431
435
|
this._dragged = !!this._panInput?.isEnabled();
|
|
432
436
|
};
|
|
433
437
|
|
|
438
|
+
/**
|
|
439
|
+
* @internal
|
|
440
|
+
* @privateRemarks
|
|
441
|
+
* Prevents click events when the user has dragged. Used for {@link FlickingOptions.preventClickOnDrag}.
|
|
442
|
+
*/
|
|
434
443
|
private _preventClickWhenDragged = (e: MouseEvent) => {
|
|
435
444
|
if (this._dragged) {
|
|
436
445
|
e.preventDefault();
|