@ue-too/board 0.5.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/LICENSE.txt +19 -0
- package/board.tsbuildinfo +1 -0
- package/boardify/index.d.ts +192 -0
- package/camera/base.d.ts +189 -0
- package/camera/camera-mux/animation-and-lock/animation-and-lock.d.ts +50 -0
- package/camera/camera-mux/animation-and-lock/index.d.ts +4 -0
- package/camera/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +137 -0
- package/camera/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +131 -0
- package/camera/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +143 -0
- package/camera/camera-mux/index.d.ts +3 -0
- package/camera/camera-mux/interface.d.ts +12 -0
- package/camera/camera-mux/relay.d.ts +27 -0
- package/camera/camera-rig/camera-rig.d.ts +207 -0
- package/camera/camera-rig/index.d.ts +5 -0
- package/camera/camera-rig/pan-handler.d.ts +113 -0
- package/camera/camera-rig/rotation-handler.d.ts +78 -0
- package/camera/camera-rig/update-batcher/index.d.ts +3 -0
- package/camera/camera-rig/update-batcher/position-update-batcher.d.ts +58 -0
- package/camera/camera-rig/update-batcher/rotation-update-batcher.d.ts +54 -0
- package/camera/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +60 -0
- package/camera/camera-rig/zoom-handler.d.ts +77 -0
- package/camera/default-camera.d.ts +170 -0
- package/camera/index.d.ts +8 -0
- package/camera/interface.d.ts +59 -0
- package/camera/update-publisher.d.ts +172 -0
- package/camera/utils/coordinate-conversion.d.ts +75 -0
- package/camera/utils/index.d.ts +5 -0
- package/camera/utils/matrix.d.ts +114 -0
- package/camera/utils/position.d.ts +71 -0
- package/camera/utils/rotation.d.ts +64 -0
- package/camera/utils/zoom.d.ts +25 -0
- package/index.d.ts +5 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/input-interpretation/index.d.ts +3 -0
- package/input-interpretation/input-state-machine/index.d.ts +4 -0
- package/input-interpretation/input-state-machine/kmt-input-context.d.ts +130 -0
- package/input-interpretation/input-state-machine/kmt-input-state-machine.d.ts +194 -0
- package/input-interpretation/input-state-machine/touch-input-context.d.ts +44 -0
- package/input-interpretation/input-state-machine/touch-input-state-machine.d.ts +64 -0
- package/input-interpretation/raw-input-parser/index.d.ts +2 -0
- package/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.d.ts +87 -0
- package/input-interpretation/raw-input-parser/vanilla-touch-event-parser.d.ts +55 -0
- package/input-interpretation/raw-input-publisher/index.d.ts +1 -0
- package/input-interpretation/raw-input-publisher/raw-input-publisher.d.ts +130 -0
- package/package.json +39 -0
- package/utils/canvas-position-dimension.d.ts +18 -0
- package/utils/coorindate-conversion.d.ts +5 -0
- package/utils/drawing-utils.d.ts +55 -0
- package/utils/drawing.d.ts +30 -0
- package/utils/handler-pipeline.d.ts +30 -0
- package/utils/index.d.ts +8 -0
- package/utils/observable.d.ts +9 -0
- package/utils/ruler.d.ts +1 -0
- package/utils/zoomlevel-adjustment.d.ts +28 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Point } from "@ue-too/math";
|
|
2
|
+
import type { EventReactions, State, BaseContext } from "@ue-too/being";
|
|
3
|
+
import { TemplateState, TemplateStateMachine } from "@ue-too/being";
|
|
4
|
+
import { BoardCamera } from "../../interface";
|
|
5
|
+
/**
|
|
6
|
+
* @description The states of the pan control state machine.
|
|
7
|
+
*
|
|
8
|
+
* @category Input Flow Control
|
|
9
|
+
*/
|
|
10
|
+
export type PanControlStates = "ACCEPTING_USER_INPUT" | "TRANSITION" | "LOCKED_ON_OBJECT";
|
|
11
|
+
/**
|
|
12
|
+
* @description The payload for the pan by input event.
|
|
13
|
+
*
|
|
14
|
+
* @category Input Flow Control
|
|
15
|
+
*/
|
|
16
|
+
export type PanByInputEventPayload = {
|
|
17
|
+
diff: Point;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @description The payload for the pan to input event.
|
|
21
|
+
*
|
|
22
|
+
* @category Input Flow Control
|
|
23
|
+
*/
|
|
24
|
+
export type PanToInputEventPayload = {
|
|
25
|
+
target: Point;
|
|
26
|
+
};
|
|
27
|
+
type EmptyPayload = {};
|
|
28
|
+
/**
|
|
29
|
+
* @description The payload mapping for the events of the pan control state machine.
|
|
30
|
+
*
|
|
31
|
+
* @category Input Flow Control
|
|
32
|
+
*/
|
|
33
|
+
export type PanEventPayloadMapping = {
|
|
34
|
+
"userPanByInput": PanByInputEventPayload;
|
|
35
|
+
"userPanToInput": PanToInputEventPayload;
|
|
36
|
+
"transitionPanByInput": PanByInputEventPayload;
|
|
37
|
+
"transitionPanToInput": PanToInputEventPayload;
|
|
38
|
+
"lockedOnObjectPanByInput": PanByInputEventPayload;
|
|
39
|
+
"lockedOnObjectPanToInput": PanToInputEventPayload;
|
|
40
|
+
"unlock": EmptyPayload;
|
|
41
|
+
"initateTransition": EmptyPayload;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @description The context for the pan control state machine.
|
|
45
|
+
*
|
|
46
|
+
* @category Input Flow Control
|
|
47
|
+
*/
|
|
48
|
+
export interface PanContext extends BaseContext {
|
|
49
|
+
camera: BoardCamera;
|
|
50
|
+
limitEntireViewPort: boolean;
|
|
51
|
+
panByViewPort: (delta: Point) => void;
|
|
52
|
+
panToViewPort: (target: Point) => void;
|
|
53
|
+
panByWorld: (delta: Point) => void;
|
|
54
|
+
panToWorld: (target: Point) => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @description The pan control state machine.
|
|
58
|
+
* It's not created directly using the TemplateStateMachine class.
|
|
59
|
+
* A few helper functions are in place to make it easier to use. (user don't have to memorize the event names)
|
|
60
|
+
*
|
|
61
|
+
* @category Input Flow Control
|
|
62
|
+
*/
|
|
63
|
+
export declare class PanControlStateMachine extends TemplateStateMachine<PanEventPayloadMapping, PanContext, PanControlStates> {
|
|
64
|
+
constructor(states: Record<PanControlStates, State<PanEventPayloadMapping, PanContext, PanControlStates>>, initialState: PanControlStates, context: PanContext);
|
|
65
|
+
/**
|
|
66
|
+
* @description Notify the pan input event.
|
|
67
|
+
*
|
|
68
|
+
* @category Input Flow Control
|
|
69
|
+
*/
|
|
70
|
+
notifyPanInput(diff: Point): void;
|
|
71
|
+
/**
|
|
72
|
+
* @description Notify the pan to animation input event.
|
|
73
|
+
*
|
|
74
|
+
* @category Input Flow Control
|
|
75
|
+
*/
|
|
76
|
+
notifyPanToAnimationInput(target: Point): void;
|
|
77
|
+
/**
|
|
78
|
+
* @description Initate the transition.
|
|
79
|
+
*
|
|
80
|
+
* @category Input Flow Control
|
|
81
|
+
*/
|
|
82
|
+
initateTransition(): void;
|
|
83
|
+
set limitEntireViewPort(limit: boolean);
|
|
84
|
+
get limitEntireViewPort(): boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @description The accepting user input state of the pan control state machine.
|
|
88
|
+
*
|
|
89
|
+
* @category Input Flow Control
|
|
90
|
+
*/
|
|
91
|
+
export declare class AcceptingUserInputState extends TemplateState<PanEventPayloadMapping, PanContext, PanControlStates> {
|
|
92
|
+
constructor();
|
|
93
|
+
eventReactions: EventReactions<PanEventPayloadMapping, PanContext, PanControlStates>;
|
|
94
|
+
userPanByInputHandler(context: PanContext, payload: PanByInputEventPayload): void;
|
|
95
|
+
userPanToInputHandler(context: PanContext, payload: PanToInputEventPayload): void;
|
|
96
|
+
lockedOnObjectPanByInputHandler(context: PanContext, payload: PanByInputEventPayload): void;
|
|
97
|
+
lockedOnObjectPanToInputHandler(context: PanContext, payload: PanToInputEventPayload): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @description The transition state of the pan control state machine.
|
|
101
|
+
*
|
|
102
|
+
* @category Input Flow Control
|
|
103
|
+
*/
|
|
104
|
+
export declare class TransitionState extends TemplateState<PanEventPayloadMapping, PanContext, PanControlStates> {
|
|
105
|
+
constructor();
|
|
106
|
+
eventReactions: EventReactions<PanEventPayloadMapping, PanContext, PanControlStates>;
|
|
107
|
+
userPanByInputHandler(context: PanContext, payload: PanByInputEventPayload): PanControlStates;
|
|
108
|
+
userPanToInputHandler(context: PanContext, payload: PanToInputEventPayload): PanControlStates;
|
|
109
|
+
transitionPanByInputHandler(context: PanContext, payload: PanByInputEventPayload): PanControlStates;
|
|
110
|
+
transitionPanToInputHandler(context: PanContext, payload: PanToInputEventPayload): PanControlStates;
|
|
111
|
+
lockedOnObjectPanByInputHandler(context: PanContext, payload: PanByInputEventPayload): PanControlStates;
|
|
112
|
+
lockedOnObjectPanToInputHandler(context: PanContext, payload: PanToInputEventPayload): PanControlStates;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @description The locked on object state of the pan control state machine.
|
|
116
|
+
*
|
|
117
|
+
* @category Input Flow Control
|
|
118
|
+
*/
|
|
119
|
+
export declare class LockedOnObjectState extends TemplateState<PanEventPayloadMapping, PanContext, PanControlStates> {
|
|
120
|
+
constructor();
|
|
121
|
+
eventReactions: EventReactions<PanEventPayloadMapping, PanContext, PanControlStates>;
|
|
122
|
+
lockedOnObjectPanByInputHandler(context: PanContext, payload: PanByInputEventPayload): void;
|
|
123
|
+
lockedOnObjectPanToInputHandler(context: PanContext, payload: PanToInputEventPayload): void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @description Create the object containing the default pan control states.
|
|
127
|
+
*
|
|
128
|
+
* @category Input Flow Control
|
|
129
|
+
*/
|
|
130
|
+
export declare function createDefaultPanControlStates(): Record<PanControlStates, State<PanEventPayloadMapping, PanContext, PanControlStates>>;
|
|
131
|
+
/**
|
|
132
|
+
* @description Create the default pan control state machine.
|
|
133
|
+
*
|
|
134
|
+
* @category Input Flow Control
|
|
135
|
+
*/
|
|
136
|
+
export declare function createDefaultPanControlStateMachine(context: PanContext): PanControlStateMachine;
|
|
137
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { EventReactions, State, BaseContext } from "@ue-too/being";
|
|
2
|
+
import { TemplateState, TemplateStateMachine } from "@ue-too/being";
|
|
3
|
+
import { BoardCamera } from "../../interface";
|
|
4
|
+
/**
|
|
5
|
+
* @description The states of the pan control state machine.
|
|
6
|
+
*
|
|
7
|
+
* @category Input Flow Control
|
|
8
|
+
*/
|
|
9
|
+
export type RotateControlStates = "ACCEPTING_USER_INPUT" | "TRANSITION" | "LOCKED_ON_OBJECT";
|
|
10
|
+
/**
|
|
11
|
+
* @description The payload for the rotate by input event.
|
|
12
|
+
*
|
|
13
|
+
* @category Input Flow Control
|
|
14
|
+
*/
|
|
15
|
+
export type RotateByInputEventPayload = {
|
|
16
|
+
diff: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @description The payload for the rotate to input event.
|
|
20
|
+
*
|
|
21
|
+
* @category Input Flow Control
|
|
22
|
+
*/
|
|
23
|
+
export type RotateToInputEventPayload = {
|
|
24
|
+
target: number;
|
|
25
|
+
};
|
|
26
|
+
type EmptyPayload = {};
|
|
27
|
+
/**
|
|
28
|
+
* @description The payload mapping for the events of the rotate control state machine.
|
|
29
|
+
*
|
|
30
|
+
* @category Input Flow Control
|
|
31
|
+
*/
|
|
32
|
+
export type RotateEventPayloadMapping = {
|
|
33
|
+
"userRotateByInput": RotateByInputEventPayload;
|
|
34
|
+
"userRotateToInput": RotateToInputEventPayload;
|
|
35
|
+
"transitionRotateByInput": RotateByInputEventPayload;
|
|
36
|
+
"transitionRotateToInput": RotateToInputEventPayload;
|
|
37
|
+
"lockedOnObjectRotateByInput": RotateByInputEventPayload;
|
|
38
|
+
"lockedOnObjectRotateToInput": RotateToInputEventPayload;
|
|
39
|
+
"unlock": EmptyPayload;
|
|
40
|
+
"initateTransition": EmptyPayload;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @description The context for the rotate control state machine.
|
|
44
|
+
*
|
|
45
|
+
* @category Input Flow Control
|
|
46
|
+
*/
|
|
47
|
+
export interface RotateContext extends BaseContext {
|
|
48
|
+
camera: BoardCamera;
|
|
49
|
+
rotateBy: (delta: number) => void;
|
|
50
|
+
rotateTo: (target: number) => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @description The pan control state machine.
|
|
54
|
+
* It's not created directly using the TemplateStateMachine class.
|
|
55
|
+
* A few helper functions are in place to make it easier to use. (user don't have to memorize the event names)
|
|
56
|
+
*
|
|
57
|
+
* @category Input Flow Control
|
|
58
|
+
*/
|
|
59
|
+
export declare class RotateControlStateMachine extends TemplateStateMachine<RotateEventPayloadMapping, RotateContext, RotateControlStates> {
|
|
60
|
+
constructor(states: Record<RotateControlStates, State<RotateEventPayloadMapping, RotateContext, RotateControlStates>>, initialState: RotateControlStates, context: RotateContext);
|
|
61
|
+
/**
|
|
62
|
+
* @description Notify the pan input event.
|
|
63
|
+
*
|
|
64
|
+
* @category Input Flow Control
|
|
65
|
+
*/
|
|
66
|
+
notifyRotateByInput(diff: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* @description Notify the rotate to animation input event.
|
|
69
|
+
*
|
|
70
|
+
* @category Input Flow Control
|
|
71
|
+
*/
|
|
72
|
+
notifyRotateToAnimationInput(target: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* @description Initate the transition.
|
|
75
|
+
*
|
|
76
|
+
* @category Input Flow Control
|
|
77
|
+
*/
|
|
78
|
+
initateTransition(): void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @description The accepting user input state of the rotate control state machine.
|
|
82
|
+
*
|
|
83
|
+
* @category Input Flow Control
|
|
84
|
+
*/
|
|
85
|
+
export declare class RotationAcceptingUserInputState extends TemplateState<RotateEventPayloadMapping, RotateContext, RotateControlStates> {
|
|
86
|
+
constructor();
|
|
87
|
+
eventReactions: EventReactions<RotateEventPayloadMapping, RotateContext, RotateControlStates>;
|
|
88
|
+
userRotateByInputHandler(context: RotateContext, payload: RotateByInputEventPayload): void;
|
|
89
|
+
userRotateToInputHandler(context: RotateContext, payload: RotateToInputEventPayload): void;
|
|
90
|
+
lockedOnObjectRotateByInputHandler(context: RotateContext, payload: RotateByInputEventPayload): void;
|
|
91
|
+
lockedOnObjectRotateToInputHandler(context: RotateContext, payload: RotateToInputEventPayload): void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @description The transition state of the rotate control state machine.
|
|
95
|
+
*
|
|
96
|
+
* @category Input Flow Control
|
|
97
|
+
*/
|
|
98
|
+
export declare class RotationTransitionState extends TemplateState<RotateEventPayloadMapping, RotateContext, RotateControlStates> {
|
|
99
|
+
constructor();
|
|
100
|
+
eventReactions: EventReactions<RotateEventPayloadMapping, RotateContext, RotateControlStates>;
|
|
101
|
+
userRotateByInputHandler(context: RotateContext, payload: RotateByInputEventPayload): RotateControlStates;
|
|
102
|
+
userRotateToInputHandler(context: RotateContext, payload: RotateToInputEventPayload): RotateControlStates;
|
|
103
|
+
transitionRotateByInputHandler(context: RotateContext, payload: RotateByInputEventPayload): RotateControlStates;
|
|
104
|
+
transitionRotateToInputHandler(context: RotateContext, payload: RotateToInputEventPayload): RotateControlStates;
|
|
105
|
+
lockedOnObjectRotateByInputHandler(context: RotateContext, payload: RotateByInputEventPayload): RotateControlStates;
|
|
106
|
+
lockedOnObjectRotateToInputHandler(context: RotateContext, payload: RotateToInputEventPayload): RotateControlStates;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @description The locked on object state of the pan control state machine.
|
|
110
|
+
*
|
|
111
|
+
* @category Input Flow Control
|
|
112
|
+
*/
|
|
113
|
+
export declare class RotationLockedOnObjectState extends TemplateState<RotateEventPayloadMapping, RotateContext, RotateControlStates> {
|
|
114
|
+
constructor();
|
|
115
|
+
eventReactions: EventReactions<RotateEventPayloadMapping, RotateContext, RotateControlStates>;
|
|
116
|
+
lockedOnObjectRotateByInputHandler(context: RotateContext, payload: RotateByInputEventPayload): void;
|
|
117
|
+
lockedOnObjectRotateToInputHandler(context: RotateContext, payload: RotateToInputEventPayload): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @description Create the object containing the default pan control states.
|
|
121
|
+
*
|
|
122
|
+
* @category Input Flow Control
|
|
123
|
+
*/
|
|
124
|
+
export declare function createDefaultRotateControlStates(): Record<RotateControlStates, State<RotateEventPayloadMapping, RotateContext, RotateControlStates>>;
|
|
125
|
+
/**
|
|
126
|
+
* @description Create the default rotate control state machine.
|
|
127
|
+
*
|
|
128
|
+
* @category Input Flow Control
|
|
129
|
+
*/
|
|
130
|
+
export declare function createDefaultRotateControlStateMachine(context: RotateContext): RotateControlStateMachine;
|
|
131
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { State, EventReactions, BaseContext } from "@ue-too/being";
|
|
2
|
+
import { TemplateState, TemplateStateMachine } from "@ue-too/being";
|
|
3
|
+
import { Point } from "@ue-too/math";
|
|
4
|
+
/**
|
|
5
|
+
* @description The possible states of the zoom control state machine.
|
|
6
|
+
*
|
|
7
|
+
* @category Input Flow Control
|
|
8
|
+
*/
|
|
9
|
+
export type ZoomControlStates = "ACCEPTING_USER_INPUT" | "TRANSITION" | "LOCKED_ON_OBJECT";
|
|
10
|
+
/**
|
|
11
|
+
* @description The payload for the zoom by at input event.
|
|
12
|
+
*
|
|
13
|
+
* @category Input Flow Control
|
|
14
|
+
*/
|
|
15
|
+
export type ZoomByAtInputPayload = {
|
|
16
|
+
deltaZoom: number;
|
|
17
|
+
anchorPoint: Point;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @description The payload for the zoom to at input event.
|
|
21
|
+
*
|
|
22
|
+
* @category Input Flow Control
|
|
23
|
+
*/
|
|
24
|
+
export type ZoomToAtInputPayload = {
|
|
25
|
+
targetZoom: number;
|
|
26
|
+
anchorPoint: Point;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @description The payload for the zoom by payload.
|
|
30
|
+
*
|
|
31
|
+
* @category Input Flow Control
|
|
32
|
+
*/
|
|
33
|
+
export type ZoomByPayload = {
|
|
34
|
+
deltaZoom: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @description The payload for the zoom to payload.
|
|
38
|
+
*
|
|
39
|
+
* @category Input Flow Control
|
|
40
|
+
*/
|
|
41
|
+
export type ZoomToPayload = {
|
|
42
|
+
targetZoom: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @description The payload mapping for the events of the zoom control state machine.
|
|
46
|
+
*
|
|
47
|
+
* @category Input Flow Control
|
|
48
|
+
*/
|
|
49
|
+
export type ZoomEventPayloadMapping = {
|
|
50
|
+
"userZoomByAtInput": ZoomByAtInputPayload;
|
|
51
|
+
"userZoomToAtInput": ZoomToAtInputPayload;
|
|
52
|
+
"transitionZoomByAtInput": ZoomByAtInputPayload;
|
|
53
|
+
"transitionZoomToAtInput": ZoomToAtInputPayload;
|
|
54
|
+
"transitionZoomByAtCenterInput": ZoomByPayload;
|
|
55
|
+
"transitionZoomToAtCenterInput": ZoomToAtInputPayload;
|
|
56
|
+
"transitionZoomToAtWorldInput": ZoomToAtInputPayload;
|
|
57
|
+
"lockedOnObjectZoomByAtInput": ZoomByAtInputPayload;
|
|
58
|
+
"lockedOnObjectZoomToAtInput": ZoomToAtInputPayload;
|
|
59
|
+
"unlock": {};
|
|
60
|
+
"initiateTransition": {};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @description The context for the zoom control state machine.
|
|
64
|
+
*
|
|
65
|
+
* @category Input Flow Control
|
|
66
|
+
*/
|
|
67
|
+
export interface ZoomContext extends BaseContext {
|
|
68
|
+
zoomToAt: (targetZoom: number, at: Point) => void;
|
|
69
|
+
zoomByAt: (delta: number, at: Point) => void;
|
|
70
|
+
zoomTo: (targetZoom: number) => void;
|
|
71
|
+
zoomBy: (delta: number) => void;
|
|
72
|
+
zoomToAtWorld: (targetZoom: number, at: Point) => void;
|
|
73
|
+
zoomByAtWorld: (delta: number, at: Point) => void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @description The accepting user input state of the zoom control state machine.
|
|
77
|
+
*
|
|
78
|
+
* @category Input Flow Control
|
|
79
|
+
*/
|
|
80
|
+
export declare class ZoomAcceptingUserInputState extends TemplateState<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates> {
|
|
81
|
+
private _eventReactions;
|
|
82
|
+
get eventReactions(): EventReactions<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates>;
|
|
83
|
+
userZoomByAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["userZoomByAtInput"]): void;
|
|
84
|
+
userZoomToAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["userZoomToAtInput"]): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @description The transition state of the zoom control state machine.
|
|
88
|
+
*
|
|
89
|
+
* @category Input Flow Control
|
|
90
|
+
*/
|
|
91
|
+
export declare class ZoomTransitionState extends TemplateState<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates> {
|
|
92
|
+
constructor();
|
|
93
|
+
private _eventReactions;
|
|
94
|
+
get eventReactions(): EventReactions<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates>;
|
|
95
|
+
lockedOnObjectZoomByAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["lockedOnObjectZoomByAtInput"]): void;
|
|
96
|
+
lockedOnObjectZoomToAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["lockedOnObjectZoomToAtInput"]): void;
|
|
97
|
+
userZoomByAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["userZoomByAtInput"]): void;
|
|
98
|
+
userZoomToAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["userZoomToAtInput"]): void;
|
|
99
|
+
transitionZoomByAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["transitionZoomByAtInput"]): void;
|
|
100
|
+
transitionZoomByAtCenterInput(context: ZoomContext, payload: ZoomEventPayloadMapping["transitionZoomByAtCenterInput"]): void;
|
|
101
|
+
transitionZoomToAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["transitionZoomToAtInput"]): void;
|
|
102
|
+
transitionZoomToAtCenterInput(context: ZoomContext, payload: ZoomEventPayloadMapping["transitionZoomToAtCenterInput"]): void;
|
|
103
|
+
transitionZoomToAtWorldInput(context: ZoomContext, payload: ZoomEventPayloadMapping["transitionZoomToAtWorldInput"]): void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @description The locked on object state of the zoom control state machine.
|
|
107
|
+
*
|
|
108
|
+
* @category Input Flow Control
|
|
109
|
+
*/
|
|
110
|
+
export declare class ZoomLockedOnObjectState extends TemplateState<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates> {
|
|
111
|
+
constructor();
|
|
112
|
+
private _eventReactions;
|
|
113
|
+
get eventReactions(): EventReactions<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates>;
|
|
114
|
+
lockedOnObjectZoomByAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["lockedOnObjectZoomByAtInput"]): void;
|
|
115
|
+
lockedOnObjectZoomToAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["lockedOnObjectZoomToAtInput"]): void;
|
|
116
|
+
userZoomByAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["userZoomByAtInput"]): void;
|
|
117
|
+
userZoomToAtInput(context: ZoomContext, payload: ZoomEventPayloadMapping["userZoomToAtInput"]): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @description The zoom control state machine.
|
|
121
|
+
*
|
|
122
|
+
* @category Input Flow Control
|
|
123
|
+
*/
|
|
124
|
+
export declare class ZoomControlStateMachine extends TemplateStateMachine<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates> {
|
|
125
|
+
constructor(states: Record<ZoomControlStates, State<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates>>, initialState: ZoomControlStates, context: ZoomContext);
|
|
126
|
+
notifyZoomByAtInput(delta: number, at: Point): void;
|
|
127
|
+
notifyZoomByAtInputAnimation(delta: number, at: Point): void;
|
|
128
|
+
notifyZoomToAtCenterInput(targetZoom: number, at: Point): void;
|
|
129
|
+
notifyZoomToAtWorldInput(targetZoom: number, at: Point): void;
|
|
130
|
+
initateTransition(): void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @description Create the object containing the default zoom control states.
|
|
134
|
+
*
|
|
135
|
+
* @category Input Flow Control
|
|
136
|
+
*/
|
|
137
|
+
export declare function createDefaultZoomControlStates(): Record<ZoomControlStates, State<ZoomEventPayloadMapping, ZoomContext, ZoomControlStates>>;
|
|
138
|
+
/**
|
|
139
|
+
* @description Create the default zoom control state machine.
|
|
140
|
+
*
|
|
141
|
+
* @category Input Flow Control
|
|
142
|
+
*/
|
|
143
|
+
export declare function createDefaultZoomControlStateMachine(context: ZoomContext): ZoomControlStateMachine;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Point } from "@ue-too/math";
|
|
2
|
+
/**
|
|
3
|
+
* @description The interface for the input flow control.
|
|
4
|
+
* It should at least have user input handlers for pan, zoom and rotation.
|
|
5
|
+
*
|
|
6
|
+
* @category Input Flow Control
|
|
7
|
+
*/
|
|
8
|
+
export interface CameraMux {
|
|
9
|
+
notifyPanInput(diff: Point): void;
|
|
10
|
+
notifyZoomInput(deltaZoomAmount: number, anchorPoint: Point): void;
|
|
11
|
+
notifyRotationInput(deltaRotation: number): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ObservableBoardCamera } from "../interface";
|
|
2
|
+
import { CameraRig } from "../camera-rig";
|
|
3
|
+
import { CameraMux } from "./interface";
|
|
4
|
+
import { Point } from "@ue-too/math";
|
|
5
|
+
/**
|
|
6
|
+
* @description The simple relay flow control.
|
|
7
|
+
* This would be the default flow control for {@link Board}.
|
|
8
|
+
*
|
|
9
|
+
* @category Input Flow Control
|
|
10
|
+
*/
|
|
11
|
+
export declare class Relay implements CameraMux {
|
|
12
|
+
private _cameraRig;
|
|
13
|
+
constructor(cameraRig?: CameraRig);
|
|
14
|
+
notifyPanInput(diff: Point): void;
|
|
15
|
+
notifyZoomInput(deltaZoomAmount: number, anchorPoint: Point): void;
|
|
16
|
+
notifyRotationInput(deltaRotation: number): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Create a default relay control center.
|
|
20
|
+
*
|
|
21
|
+
* @category Input Flow Control
|
|
22
|
+
*/
|
|
23
|
+
export declare function createDefaultCameraMux(camera: ObservableBoardCamera): CameraMux;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export declare function createDefaultCameraMuxWithCameraRig(cameraRig: CameraRig): CameraMux;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { PanHandlerConfig } from "./pan-handler";
|
|
2
|
+
import { ZoomHandlerConfig } from "./zoom-handler";
|
|
3
|
+
import type { RotationHandlerConfig } from "./rotation-handler";
|
|
4
|
+
import { ObservableBoardCamera } from "../interface";
|
|
5
|
+
import { PanContext } from "../camera-mux/animation-and-lock/pan-control-state-machine";
|
|
6
|
+
import { ZoomContext } from "../camera-mux/animation-and-lock/zoom-control-state-machine";
|
|
7
|
+
import { Point } from "@ue-too/math";
|
|
8
|
+
import { RotateContext } from "../camera-mux/animation-and-lock/rotation-control-state-machine";
|
|
9
|
+
/**
|
|
10
|
+
* @description The config for the camera rig.
|
|
11
|
+
* Camera rig combines pan, zoom and rotation handlers.
|
|
12
|
+
*
|
|
13
|
+
* @category Input Flow Control
|
|
14
|
+
*/
|
|
15
|
+
export type CameraRigConfig = PanHandlerConfig & ZoomHandlerConfig & RotationHandlerConfig;
|
|
16
|
+
export interface CameraRig extends PanContext, ZoomContext, RotateContext {
|
|
17
|
+
camera: ObservableBoardCamera;
|
|
18
|
+
config: CameraRigConfig;
|
|
19
|
+
configure(config: Partial<CameraRigConfig>): void;
|
|
20
|
+
update(): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description The camera rig.
|
|
24
|
+
*
|
|
25
|
+
* This is a consolidated handler function for pan, zoom and rotation.
|
|
26
|
+
* Essentially, it is a controller that controls the camera, so you don't have to figure out some of the math that is involved in panning, zooming and rotating the camera.
|
|
27
|
+
*
|
|
28
|
+
* @category Camera
|
|
29
|
+
*/
|
|
30
|
+
export declare class CameraRigWithUpdateBatcher implements CameraRig {
|
|
31
|
+
private _panBy;
|
|
32
|
+
private _panTo;
|
|
33
|
+
private _zoomTo;
|
|
34
|
+
private _zoomBy;
|
|
35
|
+
private _rotateBy;
|
|
36
|
+
private _rotateTo;
|
|
37
|
+
private _config;
|
|
38
|
+
private _camera;
|
|
39
|
+
private _positionBatcher;
|
|
40
|
+
private _zoomBatcher;
|
|
41
|
+
private _rotationBatcher;
|
|
42
|
+
constructor(config: PanHandlerConfig & ZoomHandlerConfig, camera?: ObservableBoardCamera);
|
|
43
|
+
/**
|
|
44
|
+
* @description Zoom to a certain zoom level at a certain point. The point is in the viewport coordinate system.
|
|
45
|
+
*/
|
|
46
|
+
zoomToAt(targetZoom: number, at: Point): void;
|
|
47
|
+
/**
|
|
48
|
+
* @description Zoom by a certain amount at a certain point. The point is in the viewport coordinate system.
|
|
49
|
+
*/
|
|
50
|
+
zoomByAt(delta: number, at: Point): void;
|
|
51
|
+
/**
|
|
52
|
+
* @description Zoom to a certain zoom level with respect to the center of the viewport.
|
|
53
|
+
*/
|
|
54
|
+
zoomTo(targetZoom: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* @description Zoom by a certain amount with respect to the center of the viewport.
|
|
57
|
+
*/
|
|
58
|
+
zoomBy(delta: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* @description Zoom to a certain zoom level with respect to a point in the world coordinate system.
|
|
61
|
+
*/
|
|
62
|
+
zoomToAtWorld(targetZoom: number, at: Point): void;
|
|
63
|
+
/**
|
|
64
|
+
* @description Zoom by a certain amount with respect to a point in the world coordinate system.
|
|
65
|
+
*/
|
|
66
|
+
zoomByAtWorld(delta: number, at: Point): void;
|
|
67
|
+
/**
|
|
68
|
+
* @description Pan to a certain point. (target is in the world coordinate system)
|
|
69
|
+
*/
|
|
70
|
+
private _actualPanByWorld;
|
|
71
|
+
/**
|
|
72
|
+
* @description Pan to a certain point. (target is in the world coordinate system)
|
|
73
|
+
*/
|
|
74
|
+
private _actualPanToWorld;
|
|
75
|
+
panByWorld(delta: Point): void;
|
|
76
|
+
panByViewPort(delta: Point): void;
|
|
77
|
+
panToWorld(target: Point): void;
|
|
78
|
+
panToViewPort(target: Point): void;
|
|
79
|
+
/**
|
|
80
|
+
* @description Rotate by a certain amount.
|
|
81
|
+
*/
|
|
82
|
+
rotateBy(delta: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* @description Rotate to a certain angle.
|
|
85
|
+
*/
|
|
86
|
+
rotateTo(target: number): void;
|
|
87
|
+
set limitEntireViewPort(limit: boolean);
|
|
88
|
+
/**
|
|
89
|
+
* @description Whether the entire view port is limited.
|
|
90
|
+
*/
|
|
91
|
+
get limitEntireViewPort(): boolean;
|
|
92
|
+
get camera(): ObservableBoardCamera;
|
|
93
|
+
get config(): CameraRigConfig;
|
|
94
|
+
set config(config: CameraRigConfig);
|
|
95
|
+
updatePosition(): void;
|
|
96
|
+
updateZoom(): void;
|
|
97
|
+
updateRotation(): void;
|
|
98
|
+
update(): void;
|
|
99
|
+
private _zoomToAtViewPort;
|
|
100
|
+
private _zoomToAtWorld;
|
|
101
|
+
private _zoomByAtViewPort;
|
|
102
|
+
private _zoomByAtWorld;
|
|
103
|
+
/**
|
|
104
|
+
* @description Configure the camera rig.
|
|
105
|
+
*/
|
|
106
|
+
configure(config: Partial<CameraRigConfig>): void;
|
|
107
|
+
/**
|
|
108
|
+
* @description Cleanup the camera rig.
|
|
109
|
+
*/
|
|
110
|
+
cleanup(): void;
|
|
111
|
+
/**
|
|
112
|
+
* @description Setup the camera rig.
|
|
113
|
+
*/
|
|
114
|
+
setup(): void;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @description Create a default camera rig with update batcher.
|
|
118
|
+
*
|
|
119
|
+
* @category Camera
|
|
120
|
+
*/
|
|
121
|
+
export declare function createDefaultCameraRigWithUpdateBatcher(camera: ObservableBoardCamera): CameraRigWithUpdateBatcher;
|
|
122
|
+
export declare class DefaultCameraRig implements CameraRig {
|
|
123
|
+
private _panBy;
|
|
124
|
+
private _panTo;
|
|
125
|
+
private _zoomTo;
|
|
126
|
+
private _zoomBy;
|
|
127
|
+
private _rotateBy;
|
|
128
|
+
private _rotateTo;
|
|
129
|
+
private _config;
|
|
130
|
+
private _camera;
|
|
131
|
+
constructor(config: PanHandlerConfig & ZoomHandlerConfig, camera?: ObservableBoardCamera);
|
|
132
|
+
/**
|
|
133
|
+
* @description Zoom to a certain zoom level at a certain point. The point is in the viewport coordinate system.
|
|
134
|
+
*/
|
|
135
|
+
zoomToAt(targetZoom: number, at: Point): void;
|
|
136
|
+
/**
|
|
137
|
+
* @description Zoom by a certain amount at a certain point. The point is in the viewport coordinate system.
|
|
138
|
+
*/
|
|
139
|
+
zoomByAt(delta: number, at: Point): void;
|
|
140
|
+
/**
|
|
141
|
+
* @description Zoom to a certain zoom level with respect to the center of the viewport.
|
|
142
|
+
*/
|
|
143
|
+
zoomTo(targetZoom: number): void;
|
|
144
|
+
/**
|
|
145
|
+
* @description Zoom by a certain amount with respect to the center of the viewport.
|
|
146
|
+
*/
|
|
147
|
+
zoomBy(delta: number): void;
|
|
148
|
+
/**
|
|
149
|
+
* @description Zoom to a certain zoom level with respect to a point in the world coordinate system.
|
|
150
|
+
*/
|
|
151
|
+
zoomToAtWorld(targetZoom: number, at: Point): void;
|
|
152
|
+
/**
|
|
153
|
+
* @description Zoom by a certain amount with respect to a point in the world coordinate system.
|
|
154
|
+
*/
|
|
155
|
+
zoomByAtWorld(delta: number, at: Point): void;
|
|
156
|
+
/**
|
|
157
|
+
* @description Pan By a certain amount. (delta is in the viewport coordinate system)
|
|
158
|
+
*/
|
|
159
|
+
panByViewPort(delta: Point): void;
|
|
160
|
+
/**
|
|
161
|
+
* @description Pan to a certain point. (target is in the world coordinate system)
|
|
162
|
+
*/
|
|
163
|
+
panByWorld(delta: Point): void;
|
|
164
|
+
/**
|
|
165
|
+
* @description Pan to a certain point. (target is in the world coordinate system)
|
|
166
|
+
*/
|
|
167
|
+
panToWorld(target: Point): void;
|
|
168
|
+
/**
|
|
169
|
+
* @description Pan to a certain point. (target is in the viewport coordinate system)
|
|
170
|
+
*/
|
|
171
|
+
panToViewPort(target: Point): void;
|
|
172
|
+
/**
|
|
173
|
+
* @description Rotate by a certain amount.
|
|
174
|
+
*/
|
|
175
|
+
rotateBy(delta: number): void;
|
|
176
|
+
/**
|
|
177
|
+
* @description Rotate to a certain angle.
|
|
178
|
+
*/
|
|
179
|
+
rotateTo(target: number): void;
|
|
180
|
+
set limitEntireViewPort(limit: boolean);
|
|
181
|
+
/**
|
|
182
|
+
* @description Whether the entire view port is limited.
|
|
183
|
+
*/
|
|
184
|
+
get limitEntireViewPort(): boolean;
|
|
185
|
+
get camera(): ObservableBoardCamera;
|
|
186
|
+
get config(): CameraRigConfig;
|
|
187
|
+
set config(config: CameraRigConfig);
|
|
188
|
+
/**
|
|
189
|
+
* @description Configure the camera rig.
|
|
190
|
+
*/
|
|
191
|
+
configure(config: Partial<CameraRigConfig>): void;
|
|
192
|
+
/**
|
|
193
|
+
* @description Cleanup the camera rig.
|
|
194
|
+
*/
|
|
195
|
+
cleanup(): void;
|
|
196
|
+
/**
|
|
197
|
+
* @description Setup the camera rig.
|
|
198
|
+
*/
|
|
199
|
+
setup(): void;
|
|
200
|
+
update(): void;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @description Create a default camera rig.
|
|
204
|
+
*
|
|
205
|
+
* @category Camera
|
|
206
|
+
*/
|
|
207
|
+
export declare function createDefaultCameraRig(camera: ObservableBoardCamera): CameraRig;
|