lythreeframe 1.2.62 → 1.2.64
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 +160 -1
- package/dist/bundle.cjs.js +193 -188
- package/dist/bundle.esm.js +193 -188
- package/dist/index.d.ts +1 -0
- package/dist/lythreeframe/Frame/Controller.d.ts +42 -20
- package/dist/lythreeframe/Object/Actor.d.ts +13 -20
- package/dist/lythreeframe/Object/Components/SceneComponent.d.ts +9 -0
- package/package.json +1 -1
|
@@ -4,29 +4,25 @@ import { World } from "./World";
|
|
|
4
4
|
import { Viewport } from "./Viewport";
|
|
5
5
|
import { Pawn } from "../Object/PawnV2/Pawn";
|
|
6
6
|
import { SceneComponent } from "../Object/Components/SceneComponent";
|
|
7
|
+
import { Actor } from "../Object/Actor";
|
|
7
8
|
import { Delegate } from "../Delegate";
|
|
8
9
|
export interface HitResult {
|
|
9
10
|
component: SceneComponent;
|
|
10
11
|
hit: Intersection;
|
|
11
12
|
}
|
|
12
|
-
/**
|
|
13
|
+
/** 组件交互事件 */
|
|
13
14
|
export interface ComponentInteractionEvent {
|
|
14
15
|
component: SceneComponent;
|
|
15
16
|
hit: Intersection;
|
|
16
|
-
/** 设置为 true 阻止组件自身的回调被调用 */
|
|
17
17
|
handled: boolean;
|
|
18
|
-
/** 点击时是否按下 Ctrl 键 */
|
|
19
18
|
ctrlKey: boolean;
|
|
20
|
-
/** 点击时是否按下 Shift 键 */
|
|
21
19
|
shiftKey: boolean;
|
|
22
|
-
/** 点击时是否按下 Alt 键 */
|
|
23
20
|
altKey: boolean;
|
|
24
21
|
}
|
|
25
22
|
/** 组件悬停事件 */
|
|
26
23
|
export interface ComponentHoverEvent {
|
|
27
24
|
component: SceneComponent;
|
|
28
25
|
hit: Intersection | null;
|
|
29
|
-
/** 设置为 true 阻止组件自身的 onHoveringBegin/End 被调用 */
|
|
30
26
|
handled: boolean;
|
|
31
27
|
}
|
|
32
28
|
/** 组件按下事件 */
|
|
@@ -34,13 +30,31 @@ export interface ComponentPointerDownEvent {
|
|
|
34
30
|
component: SceneComponent;
|
|
35
31
|
hit: Intersection;
|
|
36
32
|
button: number;
|
|
37
|
-
|
|
33
|
+
handled: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Actor 交互事件 */
|
|
36
|
+
export interface ActorInteractionEvent {
|
|
37
|
+
actor: Actor;
|
|
38
|
+
component: SceneComponent;
|
|
39
|
+
hit: Intersection;
|
|
40
|
+
handled: boolean;
|
|
41
|
+
ctrlKey: boolean;
|
|
42
|
+
shiftKey: boolean;
|
|
43
|
+
altKey: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Actor 悬停事件 */
|
|
46
|
+
export interface ActorHoverEvent {
|
|
47
|
+
actor: Actor;
|
|
48
|
+
component: SceneComponent;
|
|
49
|
+
hit: Intersection | null;
|
|
38
50
|
handled: boolean;
|
|
39
51
|
}
|
|
40
52
|
export declare class Controller {
|
|
41
53
|
protected _app: ThreeJsApp;
|
|
42
54
|
protected _pawn: Pawn | null;
|
|
43
55
|
protected raycaster: Raycaster;
|
|
56
|
+
protected hoveringComponent: SceneComponent | null;
|
|
57
|
+
protected hoveringActor: Actor | null;
|
|
44
58
|
protected prepareClickComponent: SceneComponent | null;
|
|
45
59
|
protected prepareClickHit: Intersection | null;
|
|
46
60
|
protected prepareClickModifiers: {
|
|
@@ -48,14 +62,17 @@ export declare class Controller {
|
|
|
48
62
|
shiftKey: boolean;
|
|
49
63
|
altKey: boolean;
|
|
50
64
|
};
|
|
51
|
-
protected hoveringComponent: SceneComponent | null;
|
|
52
65
|
protected _pointButtonIsDown: Set<number>;
|
|
53
|
-
protected _onClickNothingDelegate: Delegate<[void]>;
|
|
54
66
|
protected _onComponentClickDelegate: Delegate<[ComponentInteractionEvent]>;
|
|
55
67
|
protected _onComponentDoubleClickDelegate: Delegate<[ComponentInteractionEvent]>;
|
|
56
68
|
protected _onComponentHoverBeginDelegate: Delegate<[ComponentHoverEvent]>;
|
|
57
69
|
protected _onComponentHoverEndDelegate: Delegate<[ComponentHoverEvent]>;
|
|
58
70
|
protected _onComponentPointerDownDelegate: Delegate<[ComponentPointerDownEvent]>;
|
|
71
|
+
protected _onActorClickDelegate: Delegate<[ActorInteractionEvent]>;
|
|
72
|
+
protected _onActorDoubleClickDelegate: Delegate<[ActorInteractionEvent]>;
|
|
73
|
+
protected _onActorHoverBeginDelegate: Delegate<[ActorHoverEvent]>;
|
|
74
|
+
protected _onActorHoverEndDelegate: Delegate<[ActorHoverEvent]>;
|
|
75
|
+
protected _onClickNothingDelegate: Delegate<[void]>;
|
|
59
76
|
protected pointerPosition: Vector2;
|
|
60
77
|
protected pointerLeftDownPosition: Vector2;
|
|
61
78
|
protected readonly _tempVec2: Vector2;
|
|
@@ -71,34 +88,39 @@ export declare class Controller {
|
|
|
71
88
|
get world(): World;
|
|
72
89
|
get viewPort(): Viewport;
|
|
73
90
|
get app(): ThreeJsApp;
|
|
74
|
-
get
|
|
91
|
+
get pawn(): Pawn;
|
|
75
92
|
get onComponentClickDelegate(): Delegate<[ComponentInteractionEvent]>;
|
|
76
93
|
get onComponentDoubleClickDelegate(): Delegate<[ComponentInteractionEvent]>;
|
|
77
94
|
get onComponentHoverBeginDelegate(): Delegate<[ComponentHoverEvent]>;
|
|
78
95
|
get onComponentHoverEndDelegate(): Delegate<[ComponentHoverEvent]>;
|
|
79
96
|
get onComponentPointerDownDelegate(): Delegate<[ComponentPointerDownEvent]>;
|
|
80
|
-
get
|
|
97
|
+
get onActorClickDelegate(): Delegate<[ActorInteractionEvent]>;
|
|
98
|
+
get onActorDoubleClickDelegate(): Delegate<[ActorInteractionEvent]>;
|
|
99
|
+
get onActorHoverBeginDelegate(): Delegate<[ActorHoverEvent]>;
|
|
100
|
+
get onActorHoverEndDelegate(): Delegate<[ActorHoverEvent]>;
|
|
101
|
+
get onClickNothingDelegate(): Delegate<[void]>;
|
|
81
102
|
constructor(app: ThreeJsApp);
|
|
82
103
|
init(): void;
|
|
83
104
|
updateCamera(): void;
|
|
84
105
|
tick(deltaTime: number): void;
|
|
85
106
|
destroy(): void;
|
|
86
107
|
protected onPointerMoveEvent(event: MouseEvent): void;
|
|
87
|
-
protected
|
|
88
|
-
protected fireHoverEvent(component: SceneComponent, hit: Intersection | null, isBegin: boolean): void;
|
|
108
|
+
protected clearHovering(): void;
|
|
89
109
|
protected onPointerUpEvent(event: MouseEvent): void;
|
|
90
110
|
protected handleFirstClick(): void;
|
|
91
111
|
protected handleDoubleClick(): void;
|
|
92
|
-
protected fireClickEvent(component: SceneComponent, hit: Intersection, isDoubleClick: boolean, modifiers: {
|
|
93
|
-
ctrlKey: boolean;
|
|
94
|
-
shiftKey: boolean;
|
|
95
|
-
altKey: boolean;
|
|
96
|
-
}): void;
|
|
97
|
-
protected clearClickTimer(): void;
|
|
98
112
|
protected onPointerDownEvent(event: MouseEvent): void;
|
|
99
|
-
protected firePointerDownEvent(component: SceneComponent, hit: Intersection, button: number): void;
|
|
100
113
|
protected onPointerEnterEvent(_event: MouseEvent): void;
|
|
101
114
|
protected onPointerLeaveEvent(_event: MouseEvent): void;
|
|
115
|
+
protected fireComponentHoverBegin(component: SceneComponent, hit: Intersection): void;
|
|
116
|
+
protected fireComponentHoverEnd(component: SceneComponent): void;
|
|
117
|
+
protected fireComponentClick(component: SceneComponent, hit: Intersection, isDoubleClick: boolean): void;
|
|
118
|
+
protected firePointerDownEvent(component: SceneComponent, hit: Intersection, button: number): void;
|
|
119
|
+
protected fireActorHoverBegin(actor: Actor, component: SceneComponent, hit: Intersection): void;
|
|
120
|
+
protected fireActorHoverEnd(actor: Actor, component: SceneComponent): void;
|
|
121
|
+
protected fireActorClick(actor: Actor, component: SceneComponent, hit: Intersection, isDoubleClick: boolean): void;
|
|
122
|
+
protected fireClickEvents(component: SceneComponent, hit: Intersection, isDoubleClick: boolean): void;
|
|
123
|
+
protected clearClickTimer(): void;
|
|
102
124
|
protected addCorePointerListeners(): void;
|
|
103
125
|
protected removeCorePointerListeners(): void;
|
|
104
126
|
getHitResultUnderCursor(): HitResult | null;
|
|
@@ -4,6 +4,7 @@ import { BaseObject } from "./BaseObject";
|
|
|
4
4
|
import { World } from "../Frame/World";
|
|
5
5
|
import { ThreeJsApp } from "../ThreeJsApp";
|
|
6
6
|
import { SceneComponent } from "./Components/SceneComponent";
|
|
7
|
+
import { Delegate } from "../Delegate";
|
|
7
8
|
export declare class Actor extends BaseObject {
|
|
8
9
|
get world(): World | null;
|
|
9
10
|
get name(): string;
|
|
@@ -20,10 +21,14 @@ export declare class Actor extends BaseObject {
|
|
|
20
21
|
protected _rootComponent: SceneComponent | null;
|
|
21
22
|
protected _world: World | null;
|
|
22
23
|
protected app: ThreeJsApp;
|
|
23
|
-
protected
|
|
24
|
-
protected
|
|
25
|
-
protected
|
|
26
|
-
protected
|
|
24
|
+
protected _onHoverBeginDelegate: Delegate<[SceneComponent]>;
|
|
25
|
+
protected _onHoverEndDelegate: Delegate<[SceneComponent]>;
|
|
26
|
+
protected _onClickDelegate: Delegate<[SceneComponent]>;
|
|
27
|
+
protected _onDoubleClickDelegate: Delegate<[SceneComponent]>;
|
|
28
|
+
get onHoverBeginDelegate(): Delegate<[SceneComponent]>;
|
|
29
|
+
get onHoverEndDelegate(): Delegate<[SceneComponent]>;
|
|
30
|
+
get onClickDelegate(): Delegate<[SceneComponent]>;
|
|
31
|
+
get onDoubleClickDelegate(): Delegate<[SceneComponent]>;
|
|
27
32
|
constructor(app: ThreeJsApp, uuid?: string);
|
|
28
33
|
protected constructRootComponent(): SceneComponent;
|
|
29
34
|
getBoundsCenterPosition(bInWorldSpace?: boolean): Vector3;
|
|
@@ -73,20 +78,8 @@ export declare class Actor extends BaseObject {
|
|
|
73
78
|
set isHoverEnabled(bCanHorver: boolean);
|
|
74
79
|
get isClickEnabled(): boolean;
|
|
75
80
|
set isClickEnabled(bCanHorver: boolean);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
addHoveringEndEvent(newFunc: (component?: SceneComponent) => void): void;
|
|
81
|
-
removeHoveringEndEvent(target: (component?: SceneComponent) => void): void;
|
|
82
|
-
clearHoveringEndEvent(): void;
|
|
83
|
-
onComponentHorveringEnd(component: SceneComponent): void;
|
|
84
|
-
addClickEvent(newFunc: (component?: SceneComponent) => void): void;
|
|
85
|
-
removeClickEvent(target: (component?: SceneComponent) => void): void;
|
|
86
|
-
clearClickEvent(): void;
|
|
87
|
-
onComponentClicked(component: SceneComponent): void;
|
|
88
|
-
addDoubleClickEvent(newFunc: (component?: SceneComponent) => void): void;
|
|
89
|
-
removeDoubleClickEvent(target: (component?: SceneComponent) => void): void;
|
|
90
|
-
onComponentDoubleClicked(component: SceneComponent): void;
|
|
91
|
-
clearDoubleClickEvent(): void;
|
|
81
|
+
onActorHoverBegin(component: SceneComponent): void;
|
|
82
|
+
onActorHoverEnd(component: SceneComponent): void;
|
|
83
|
+
onActorClick(component: SceneComponent): void;
|
|
84
|
+
onActorDoubleClick(component: SceneComponent): void;
|
|
92
85
|
}
|
|
@@ -4,11 +4,20 @@ import { Component } from "./Component";
|
|
|
4
4
|
import { World } from "../../Frame/World";
|
|
5
5
|
import { AttachmentRules } from "../../Defines";
|
|
6
6
|
import { ThreeJsApp } from "../../ThreeJsApp";
|
|
7
|
+
import { Delegate } from "../../Delegate";
|
|
7
8
|
export declare class SceneComponent extends Component {
|
|
8
9
|
set parentActor(value: Actor | null);
|
|
9
10
|
get parentActor(): Actor | null;
|
|
10
11
|
protected bCanHover: boolean;
|
|
11
12
|
protected bCanClick: boolean;
|
|
13
|
+
protected _onHoverBeginDelegate: Delegate<[void]>;
|
|
14
|
+
protected _onHoverEndDelegate: Delegate<[void]>;
|
|
15
|
+
protected _onClickDelegate: Delegate<[void]>;
|
|
16
|
+
protected _onDoubleClickDelegate: Delegate<[void]>;
|
|
17
|
+
get onHoverBeginDelegate(): Delegate<[void]>;
|
|
18
|
+
get onHoverEndDelegate(): Delegate<[void]>;
|
|
19
|
+
get onClickDelegate(): Delegate<[void]>;
|
|
20
|
+
get onDoubleClickDelegate(): Delegate<[void]>;
|
|
12
21
|
get world(): World;
|
|
13
22
|
protected app: ThreeJsApp;
|
|
14
23
|
constructor(app: ThreeJsApp, uuid?: string);
|