@egjs/flicking 4.4.2 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declaration/Flicking.d.ts +8 -2
- package/declaration/camera/Camera.d.ts +26 -24
- package/declaration/camera/index.d.ts +2 -4
- package/declaration/camera/mode/BoundCameraMode.d.ts +13 -0
- package/declaration/camera/mode/CameraMode.d.ts +19 -0
- package/declaration/camera/mode/CircularCameraMode.d.ts +18 -0
- package/declaration/camera/mode/LinearCameraMode.d.ts +9 -0
- package/declaration/camera/mode/index.d.ts +6 -0
- package/declaration/const/external.d.ts +4 -0
- package/declaration/type/external.d.ts +1 -3
- package/dist/flicking.esm.js +1181 -1090
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +1184 -1092
- 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 +1183 -1091
- 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 +4 -3
- package/src/Flicking.ts +26 -15
- package/src/camera/Camera.ts +155 -70
- package/src/camera/index.ts +3 -7
- package/src/camera/{BoundCamera.ts → mode/BoundCameraMode.ts} +46 -43
- package/src/camera/mode/CameraMode.ts +77 -0
- package/src/camera/mode/CircularCameraMode.ts +171 -0
- package/src/camera/mode/LinearCameraMode.ts +23 -0
- package/src/camera/mode/index.ts +14 -0
- package/src/const/external.ts +12 -0
- package/declaration/camera/BoundCamera.d.ts +0 -9
- package/declaration/camera/CircularCamera.d.ts +0 -37
- package/declaration/camera/LinearCamera.d.ts +0 -5
- package/src/camera/CircularCamera.ts +0 -268
- package/src/camera/LinearCamera.ts +0 -35
|
@@ -2,40 +2,46 @@
|
|
|
2
2
|
* Copyright (c) 2015 NAVER Corp.
|
|
3
3
|
* egjs projects are licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
5
|
+
import AnchorPoint from "../../core/AnchorPoint";
|
|
6
|
+
import Panel from "../../core/panel/Panel";
|
|
7
|
+
import { parseAlign } from "../../utils";
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import CameraMode from "./CameraMode";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
11
|
+
class BoundCameraMode extends CameraMode {
|
|
12
|
+
public checkAvailability(): boolean {
|
|
13
|
+
const flicking = this._flicking;
|
|
14
|
+
const renderer = flicking.renderer;
|
|
15
|
+
|
|
16
|
+
const firstPanel = renderer.getPanel(0);
|
|
17
|
+
const lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
18
|
+
|
|
19
|
+
if (!firstPanel || !lastPanel) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const viewportSize = flicking.camera.size;
|
|
24
|
+
const firstPanelPrev = firstPanel.range.min;
|
|
25
|
+
const lastPanelNext = lastPanel.range.max;
|
|
26
|
+
const panelAreaSize = lastPanelNext - firstPanelPrev;
|
|
27
|
+
const isBiggerThanViewport = viewportSize < panelAreaSize;
|
|
28
|
+
|
|
29
|
+
return isBiggerThanViewport;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public getRange(): { min: number; max: number } {
|
|
33
|
+
const flicking = this._flicking;
|
|
27
34
|
const renderer = flicking.renderer;
|
|
28
|
-
const alignPos =
|
|
35
|
+
const alignPos = flicking.camera.alignPosition;
|
|
29
36
|
|
|
30
37
|
const firstPanel = renderer.getPanel(0);
|
|
31
38
|
const lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
32
39
|
|
|
33
40
|
if (!firstPanel || !lastPanel) {
|
|
34
|
-
|
|
35
|
-
return this;
|
|
41
|
+
return { min: 0, max: 0 };
|
|
36
42
|
}
|
|
37
43
|
|
|
38
|
-
const viewportSize =
|
|
44
|
+
const viewportSize = flicking.camera.size;
|
|
39
45
|
const firstPanelPrev = firstPanel.range.min;
|
|
40
46
|
const lastPanelNext = lastPanel.range.max;
|
|
41
47
|
const panelAreaSize = lastPanelNext - firstPanelPrev;
|
|
@@ -45,32 +51,30 @@ class BoundCamera extends Camera {
|
|
|
45
51
|
const lastPos = lastPanelNext - viewportSize + alignPos;
|
|
46
52
|
|
|
47
53
|
if (isBiggerThanViewport) {
|
|
48
|
-
|
|
54
|
+
return { min: firstPos, max: lastPos };
|
|
49
55
|
} else {
|
|
50
|
-
const align =
|
|
56
|
+
const align = flicking.camera.align;
|
|
51
57
|
const alignVal = typeof align === "object"
|
|
52
58
|
? (align as { camera: string | number }).camera
|
|
53
59
|
: align;
|
|
54
60
|
|
|
55
61
|
const pos = firstPos + parseAlign(alignVal, lastPos - firstPos);
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
return { min: pos, max: pos };
|
|
58
64
|
}
|
|
59
|
-
|
|
60
|
-
return this;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
public
|
|
64
|
-
const flicking =
|
|
67
|
+
public getAnchors(): AnchorPoint[] {
|
|
68
|
+
const flicking = this._flicking;
|
|
69
|
+
const camera = flicking.camera;
|
|
65
70
|
const panels = flicking.renderer.panels;
|
|
66
71
|
|
|
67
72
|
if (panels.length <= 0) {
|
|
68
|
-
|
|
69
|
-
return this;
|
|
73
|
+
return [];
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
const range =
|
|
73
|
-
const reachablePanels = panels.filter(panel =>
|
|
76
|
+
const range = flicking.camera.range;
|
|
77
|
+
const reachablePanels = panels.filter(panel => camera.canReach(panel));
|
|
74
78
|
|
|
75
79
|
if (reachablePanels.length > 0) {
|
|
76
80
|
const shouldPrependBoundAnchor = reachablePanels[0].position !== range.min;
|
|
@@ -99,7 +103,7 @@ class BoundCamera extends Camera {
|
|
|
99
103
|
}));
|
|
100
104
|
}
|
|
101
105
|
|
|
102
|
-
|
|
106
|
+
return newAnchors;
|
|
103
107
|
} else if (range.min !== range.max) {
|
|
104
108
|
// There're more than 2 panels
|
|
105
109
|
const nearestPanelAtMin = this._findNearestPanel(range.min, panels);
|
|
@@ -108,7 +112,7 @@ class BoundCamera extends Camera {
|
|
|
108
112
|
: nearestPanelAtMin;
|
|
109
113
|
const panelAtMax = panelAtMin.next()!;
|
|
110
114
|
|
|
111
|
-
|
|
115
|
+
return [
|
|
112
116
|
new AnchorPoint({
|
|
113
117
|
index: 0,
|
|
114
118
|
position: range.min,
|
|
@@ -121,19 +125,18 @@ class BoundCamera extends Camera {
|
|
|
121
125
|
})
|
|
122
126
|
];
|
|
123
127
|
} else {
|
|
124
|
-
|
|
128
|
+
return [new AnchorPoint({
|
|
125
129
|
index: 0,
|
|
126
130
|
position: range.min,
|
|
127
131
|
panel: this._findNearestPanel(range.min, panels)
|
|
128
132
|
})];
|
|
129
133
|
}
|
|
130
|
-
|
|
131
|
-
return this;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
public findAnchorIncludePosition(position: number): AnchorPoint | null {
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
+
const camera = this._flicking.camera;
|
|
138
|
+
const range = camera.range;
|
|
139
|
+
const anchors = camera.anchorPoints;
|
|
137
140
|
|
|
138
141
|
if (anchors.length <= 0) return null;
|
|
139
142
|
|
|
@@ -165,4 +168,4 @@ class BoundCamera extends Camera {
|
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
export default
|
|
171
|
+
export default BoundCameraMode;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
3
|
+
* egjs projects are licensed under the MIT license
|
|
4
|
+
*/
|
|
5
|
+
import Flicking from "../../Flicking";
|
|
6
|
+
import Panel from "../../core/panel/Panel";
|
|
7
|
+
import AnchorPoint from "../../core/AnchorPoint";
|
|
8
|
+
import { clamp } from "../../utils";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A mode of camera
|
|
12
|
+
*/
|
|
13
|
+
abstract class CameraMode {
|
|
14
|
+
protected _flicking: Flicking;
|
|
15
|
+
|
|
16
|
+
/** */
|
|
17
|
+
public constructor(flicking: Flicking) {
|
|
18
|
+
this._flicking = flicking;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public abstract checkAvailability(): boolean;
|
|
22
|
+
public abstract getRange(): { min: number; max: number };
|
|
23
|
+
|
|
24
|
+
public getAnchors(): AnchorPoint[] {
|
|
25
|
+
const panels = this._flicking.renderer.panels;
|
|
26
|
+
|
|
27
|
+
return panels.map((panel, index) => new AnchorPoint({
|
|
28
|
+
index,
|
|
29
|
+
position: panel.position,
|
|
30
|
+
panel
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public findAnchorIncludePosition(position: number): AnchorPoint | null {
|
|
35
|
+
const anchors = this._flicking.camera.anchorPoints;
|
|
36
|
+
const anchorsIncludingPosition = anchors.filter(anchor => anchor.panel.includePosition(position, true));
|
|
37
|
+
|
|
38
|
+
return anchorsIncludingPosition.reduce((nearest: AnchorPoint | null, anchor) => {
|
|
39
|
+
if (!nearest) return anchor;
|
|
40
|
+
|
|
41
|
+
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position)
|
|
42
|
+
? nearest
|
|
43
|
+
: anchor;
|
|
44
|
+
}, null);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public clampToReachablePosition(position: number): number {
|
|
48
|
+
const camera = this._flicking.camera;
|
|
49
|
+
const range = camera.range;
|
|
50
|
+
|
|
51
|
+
return clamp(position, range.min, range.max);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public getCircularOffset(): number {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public canReach(panel: Panel): boolean {
|
|
59
|
+
const camera = this._flicking.camera;
|
|
60
|
+
const range = camera.range;
|
|
61
|
+
|
|
62
|
+
if (panel.removed) return false;
|
|
63
|
+
|
|
64
|
+
const panelPos = panel.position;
|
|
65
|
+
|
|
66
|
+
return panelPos >= range.min && panelPos <= range.max;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public canSee(panel: Panel): boolean {
|
|
70
|
+
const camera = this._flicking.camera;
|
|
71
|
+
const visibleRange = camera.visibleRange;
|
|
72
|
+
// Should not include margin, as we don't declare what the margin is visible as what the panel is visible.
|
|
73
|
+
return panel.isVisibleOnRange(visibleRange.min, visibleRange.max);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default CameraMode;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
3
|
+
* egjs projects are licensed under the MIT license
|
|
4
|
+
*/
|
|
5
|
+
import Panel from "../../core/panel/Panel";
|
|
6
|
+
import AnchorPoint from "../../core/AnchorPoint";
|
|
7
|
+
import { DIRECTION } from "../../const/external";
|
|
8
|
+
import { circulatePosition } from "../../utils";
|
|
9
|
+
|
|
10
|
+
import CameraMode from "./CameraMode";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A {@link Camera} mode that connects the last panel and the first panel, enabling continuous loop
|
|
14
|
+
* @ko 첫번째 패널과 마지막 패널이 이어진 상태로, 무한히 회전할 수 있는 종류의 {@link Camera} 모드
|
|
15
|
+
*/
|
|
16
|
+
class CircularCameraMode extends CameraMode {
|
|
17
|
+
public checkAvailability(): boolean {
|
|
18
|
+
const flicking = this._flicking;
|
|
19
|
+
const renderer = flicking.renderer;
|
|
20
|
+
const panels = renderer.panels;
|
|
21
|
+
|
|
22
|
+
if (panels.length <= 0) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const firstPanel = panels[0];
|
|
27
|
+
const lastPanel = panels[panels.length - 1];
|
|
28
|
+
const firstPanelPrev = firstPanel.range.min - firstPanel.margin.prev;
|
|
29
|
+
const lastPanelNext = lastPanel.range.max + lastPanel.margin.next;
|
|
30
|
+
|
|
31
|
+
const visibleSize = flicking.camera.size;
|
|
32
|
+
const panelSizeSum = lastPanelNext - firstPanelPrev;
|
|
33
|
+
|
|
34
|
+
const canSetCircularMode = panels
|
|
35
|
+
.every(panel => panelSizeSum - panel.size >= visibleSize);
|
|
36
|
+
|
|
37
|
+
return canSetCircularMode;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public getRange(): { min: number; max: number } {
|
|
41
|
+
const flicking = this._flicking;
|
|
42
|
+
const panels = flicking.renderer.panels;
|
|
43
|
+
|
|
44
|
+
if (panels.length <= 0) {
|
|
45
|
+
return { min: 0, max: 0 };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const firstPanel = panels[0];
|
|
49
|
+
const lastPanel = panels[panels.length - 1];
|
|
50
|
+
const firstPanelPrev = firstPanel.range.min - firstPanel.margin.prev;
|
|
51
|
+
const lastPanelNext = lastPanel.range.max + lastPanel.margin.next;
|
|
52
|
+
|
|
53
|
+
return { min: firstPanelPrev, max: lastPanelNext };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public getAnchors(): AnchorPoint[] {
|
|
57
|
+
const flicking = this._flicking;
|
|
58
|
+
const panels = flicking.renderer.panels;
|
|
59
|
+
|
|
60
|
+
return panels.map((panel, index) => new AnchorPoint({
|
|
61
|
+
index,
|
|
62
|
+
position: panel.position,
|
|
63
|
+
panel
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public findAnchorIncludePosition(position: number): AnchorPoint | null {
|
|
68
|
+
const camera = this._flicking.camera;
|
|
69
|
+
const range = camera.range;
|
|
70
|
+
const anchors = camera.anchorPoints;
|
|
71
|
+
const rangeDiff = camera.rangeDiff;
|
|
72
|
+
const anchorCount = anchors.length;
|
|
73
|
+
const positionInRange = circulatePosition(position, range.min, range.max);
|
|
74
|
+
|
|
75
|
+
let anchorInRange: AnchorPoint | null = super.findAnchorIncludePosition(positionInRange);
|
|
76
|
+
|
|
77
|
+
if (anchorCount > 0 && (position === range.min || position === range.max)) {
|
|
78
|
+
const possibleAnchors = [
|
|
79
|
+
anchorInRange,
|
|
80
|
+
new AnchorPoint({
|
|
81
|
+
index: 0,
|
|
82
|
+
position: anchors[0].position + rangeDiff,
|
|
83
|
+
panel: anchors[0].panel
|
|
84
|
+
}),
|
|
85
|
+
new AnchorPoint({
|
|
86
|
+
index: anchorCount - 1,
|
|
87
|
+
position: anchors[anchorCount - 1].position - rangeDiff,
|
|
88
|
+
panel: anchors[anchorCount - 1].panel
|
|
89
|
+
})
|
|
90
|
+
].filter(anchor => !!anchor) as AnchorPoint[];
|
|
91
|
+
|
|
92
|
+
anchorInRange = possibleAnchors.reduce((nearest: AnchorPoint | null, anchor) => {
|
|
93
|
+
if (!nearest) return anchor;
|
|
94
|
+
|
|
95
|
+
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position)
|
|
96
|
+
? nearest
|
|
97
|
+
: anchor;
|
|
98
|
+
}, null);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!anchorInRange) return null;
|
|
102
|
+
|
|
103
|
+
if (position < range.min) {
|
|
104
|
+
const loopCount = -Math.floor((range.min - position) / rangeDiff) - 1;
|
|
105
|
+
|
|
106
|
+
return new AnchorPoint({
|
|
107
|
+
index: anchorInRange.index,
|
|
108
|
+
position: anchorInRange.position + rangeDiff * loopCount,
|
|
109
|
+
panel: anchorInRange.panel
|
|
110
|
+
});
|
|
111
|
+
} else if (position > range.max) {
|
|
112
|
+
const loopCount = Math.floor((position - range.max) / rangeDiff) + 1;
|
|
113
|
+
|
|
114
|
+
return new AnchorPoint({
|
|
115
|
+
index: anchorInRange.index,
|
|
116
|
+
position: anchorInRange.position + rangeDiff * loopCount,
|
|
117
|
+
panel: anchorInRange.panel
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return anchorInRange;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public getCircularOffset(): number {
|
|
125
|
+
const flicking = this._flicking;
|
|
126
|
+
const camera = flicking.camera;
|
|
127
|
+
|
|
128
|
+
if (!camera.circularEnabled) return 0;
|
|
129
|
+
|
|
130
|
+
const toggled = flicking.panels.filter(panel => panel.toggled);
|
|
131
|
+
const toggledPrev = toggled.filter(panel => panel.toggleDirection === DIRECTION.PREV);
|
|
132
|
+
const toggledNext = toggled.filter(panel => panel.toggleDirection === DIRECTION.NEXT);
|
|
133
|
+
|
|
134
|
+
return this._calcPanelAreaSum(toggledPrev) - this._calcPanelAreaSum(toggledNext);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public clampToReachablePosition(position: number): number {
|
|
138
|
+
// Basically all position is reachable for circular camera
|
|
139
|
+
return position;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public canReach(panel: Panel): boolean {
|
|
143
|
+
if (panel.removed) return false;
|
|
144
|
+
|
|
145
|
+
// Always reachable on circular mode
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public canSee(panel: Panel): boolean {
|
|
150
|
+
const camera = this._flicking.camera;
|
|
151
|
+
const range = camera.range;
|
|
152
|
+
const rangeDiff = camera.rangeDiff;
|
|
153
|
+
const visibleRange = camera.visibleRange;
|
|
154
|
+
const visibleInCurrentRange = super.canSee(panel);
|
|
155
|
+
|
|
156
|
+
// Check looped visible area for circular case
|
|
157
|
+
if (visibleRange.min < range.min) {
|
|
158
|
+
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff);
|
|
159
|
+
} else if (visibleRange.max > range.max) {
|
|
160
|
+
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return visibleInCurrentRange;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private _calcPanelAreaSum(panels: Panel[]) {
|
|
167
|
+
return panels.reduce((sum: number, panel: Panel) => sum + panel.sizeIncludingMargin, 0);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export default CircularCameraMode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
3
|
+
* egjs projects are licensed under the MIT license
|
|
4
|
+
*/
|
|
5
|
+
import CameraMode from "./CameraMode";
|
|
6
|
+
|
|
7
|
+
class LinearCameraMode extends CameraMode {
|
|
8
|
+
public checkAvailability(): boolean {
|
|
9
|
+
// It's always available
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public getRange(): { min: number; max: number } {
|
|
14
|
+
const renderer = this._flicking.renderer;
|
|
15
|
+
|
|
16
|
+
const firstPanel = renderer.getPanel(0);
|
|
17
|
+
const lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
18
|
+
|
|
19
|
+
return { min: firstPanel?.position ?? 0, max: lastPanel?.position ?? 0 };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default LinearCameraMode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import CameraMode from "./CameraMode";
|
|
2
|
+
import LinearCameraMode from "./LinearCameraMode";
|
|
3
|
+
import CircularCameraMode from "./CircularCameraMode";
|
|
4
|
+
import BoundCameraMode from "./BoundCameraMode";
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
LinearCameraMode,
|
|
8
|
+
CircularCameraMode,
|
|
9
|
+
BoundCameraMode
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
CameraMode
|
|
14
|
+
};
|
package/src/const/external.ts
CHANGED
|
@@ -98,3 +98,15 @@ export const CLASS = {
|
|
|
98
98
|
HIDDEN: "flicking-hidden",
|
|
99
99
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
100
100
|
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* An object with all possible {@link Flicking#circularFallback circularFallback}s
|
|
104
|
+
* @ko Flicking의 {@link Flicking#circularFallback circularFallback}에 설정 가능한 값들을 담고 있는 객체
|
|
105
|
+
* @type {object}
|
|
106
|
+
* @property {string} LINEAR "linear"
|
|
107
|
+
* @property {string} BOUND "bound"
|
|
108
|
+
*/
|
|
109
|
+
export const CIRCULAR_FALLBACK = {
|
|
110
|
+
LINEAR: "linear",
|
|
111
|
+
BOUND: "bound"
|
|
112
|
+
} as const;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import AnchorPoint from "../core/AnchorPoint";
|
|
2
|
-
import Camera from "./Camera";
|
|
3
|
-
declare class BoundCamera extends Camera {
|
|
4
|
-
updateRange(): this;
|
|
5
|
-
updateAnchors(): this;
|
|
6
|
-
findAnchorIncludePosition(position: number): AnchorPoint | null;
|
|
7
|
-
private _findNearestPanel;
|
|
8
|
-
}
|
|
9
|
-
export default BoundCamera;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Panel from "../core/panel/Panel";
|
|
2
|
-
import AnchorPoint from "../core/AnchorPoint";
|
|
3
|
-
import { DIRECTION } from "../const/external";
|
|
4
|
-
import { ValueOf } from "../type/internal";
|
|
5
|
-
import Camera from "./Camera";
|
|
6
|
-
export interface TogglePoint {
|
|
7
|
-
panel: Panel;
|
|
8
|
-
direction: ValueOf<typeof DIRECTION>;
|
|
9
|
-
toggled: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare class CircularCamera extends Camera {
|
|
12
|
-
private _circularOffset;
|
|
13
|
-
private _circularEnabled;
|
|
14
|
-
get offset(): number;
|
|
15
|
-
get controlParams(): {
|
|
16
|
-
range: {
|
|
17
|
-
min: number;
|
|
18
|
-
max: number;
|
|
19
|
-
};
|
|
20
|
-
position: number;
|
|
21
|
-
circular: boolean;
|
|
22
|
-
};
|
|
23
|
-
getPrevAnchor(anchor: AnchorPoint): AnchorPoint | null;
|
|
24
|
-
getNextAnchor(anchor: AnchorPoint): AnchorPoint | null;
|
|
25
|
-
findAnchorIncludePosition(position: number): AnchorPoint | null;
|
|
26
|
-
clampToReachablePosition(position: number): number;
|
|
27
|
-
canReach(panel: Panel): boolean;
|
|
28
|
-
canSee(panel: Panel): boolean;
|
|
29
|
-
updateRange(): this;
|
|
30
|
-
updateOffset(): this;
|
|
31
|
-
lookAt(pos: number): void;
|
|
32
|
-
applyTransform(): this;
|
|
33
|
-
protected _resetInternalValues(): void;
|
|
34
|
-
private _calcPanelAreaSum;
|
|
35
|
-
private _updateCircularOffset;
|
|
36
|
-
}
|
|
37
|
-
export default CircularCamera;
|