@x-viewer/editor 0.9.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/README.md +3 -0
- package/dist/index.esm.js +96 -0
- package/dist/types/Editor.d.ts +14 -0
- package/dist/types/EventBus.d.ts +17 -0
- package/dist/types/drawables/Door2dDrawable.d.ts +6 -0
- package/dist/types/drawables/Object2dDrawable.d.ts +30 -0
- package/dist/types/drawables/Room2dDrawable.d.ts +21 -0
- package/dist/types/gizmo/Gizmo.d.ts +142 -0
- package/dist/types/gizmo/TransformControls.d.ts +291 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interactions/BaseDrawInteraction.d.ts +32 -0
- package/dist/types/interactions/DrawObject2dInteraction.d.ts +15 -0
- package/dist/types/interactions/DrawWall2dInteraction.d.ts +16 -0
- package/dist/types/interactions/Editor2dInteraction.d.ts +21 -0
- package/dist/types/interactions/Editor3dInteraction.d.ts +18 -0
- package/dist/types/viewers/EditorModel3d.d.ts +4 -0
- package/dist/types/viewers/EditorViewer2d.d.ts +28 -0
- package/dist/types/viewers/EditorViewer3d.d.ts +24 -0
- package/package.json +47 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditorViewer2d } from "./viewers/EditorViewer2d";
|
|
2
|
+
import { EditorViewer3d } from "./viewers/EditorViewer3d";
|
|
3
|
+
export declare class Editor {
|
|
4
|
+
cfg: any;
|
|
5
|
+
viewer2d: EditorViewer2d;
|
|
6
|
+
viewer3d: EditorViewer3d;
|
|
7
|
+
constructor(cfg: any);
|
|
8
|
+
init(): void;
|
|
9
|
+
getAssetList(): import("@x-viewer/builder").AssetInfo[];
|
|
10
|
+
getModelInfo(id: string): import("@x-viewer/builder").AssetInfo | undefined;
|
|
11
|
+
getModelProperties(id: string): Record<string, any> | undefined;
|
|
12
|
+
loadExternalAssets(externalUrl: string, datas: any[]): void;
|
|
13
|
+
setDrawMode(mode: string, drawAssetId: string): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Event } from "@x-viewer/core";
|
|
2
|
+
export declare enum EditorEvent {
|
|
3
|
+
createWall = "createWall",
|
|
4
|
+
updateWall = "updateWall",
|
|
5
|
+
createObject = "createObject",
|
|
6
|
+
selectObject = "selectObject",
|
|
7
|
+
updateObject = "updateObject",
|
|
8
|
+
exitDrawMode = "exitDrawMode",
|
|
9
|
+
gizmoDraggingStart = "gizmoDraggingStart",
|
|
10
|
+
gizmoDragging = "gizmoDragging",
|
|
11
|
+
gizmoDraggingEnd = "gizmoDraggingEnd"
|
|
12
|
+
}
|
|
13
|
+
type ViewerEvents = {
|
|
14
|
+
[K in EditorEvent]: any;
|
|
15
|
+
};
|
|
16
|
+
export declare const eventBus: Event<ViewerEvents>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Drawable, THREE } from "@x-viewer/core";
|
|
2
|
+
export declare class Object2dDrawable extends Drawable {
|
|
3
|
+
protected lineWidth: number;
|
|
4
|
+
protected lineColor: number[];
|
|
5
|
+
protected fillColor: number[];
|
|
6
|
+
text: string;
|
|
7
|
+
renderOrder: number;
|
|
8
|
+
editable: boolean;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
position: THREE.Vector3;
|
|
12
|
+
rotation2D: number;
|
|
13
|
+
scale: THREE.Vector3;
|
|
14
|
+
matrix: THREE.Matrix4;
|
|
15
|
+
matrixNeedsUpdate: boolean;
|
|
16
|
+
constructor(id: string, cfg: any);
|
|
17
|
+
setPoints(points: THREE.Vector3[]): void;
|
|
18
|
+
setPosition(x: number, y: number, z: number): void;
|
|
19
|
+
getPosition(): THREE.Vector3;
|
|
20
|
+
setRotation2D(rotation: number): void;
|
|
21
|
+
getRotation2D(): number;
|
|
22
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
23
|
+
drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
24
|
+
drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
25
|
+
drawEditPoints(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
26
|
+
getVertexes(): THREE.Vector3[];
|
|
27
|
+
isPointInPath(p: THREE.Vector3): boolean;
|
|
28
|
+
clone(): Object2dDrawable;
|
|
29
|
+
getClassType(): string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PathDrawable, THREE } from "@x-viewer/core";
|
|
2
|
+
export declare class Room2dDrawable extends PathDrawable {
|
|
3
|
+
protected lineWidth: number;
|
|
4
|
+
protected lineColor: number[];
|
|
5
|
+
protected fillColor: number[];
|
|
6
|
+
protected selectedEdgeIndex: number;
|
|
7
|
+
protected selectedPointIndex: number;
|
|
8
|
+
renderOrder: number;
|
|
9
|
+
assetId: string;
|
|
10
|
+
constructor(id: string, points: THREE.Vector3[], assetId: string);
|
|
11
|
+
setPoints(points: THREE.Vector3[]): void;
|
|
12
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
13
|
+
drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
14
|
+
drawSelectBody(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
15
|
+
drawSelectEdge(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
16
|
+
drawPoints(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
17
|
+
isSelectEdge(p: THREE.Vector3): number;
|
|
18
|
+
isSelectPoint(p: THREE.Vector3): number;
|
|
19
|
+
updatePointByIndex(index: number, newPosition: THREE.Vector3): void;
|
|
20
|
+
isPointInPath(p: THREE.Vector3): boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { BaseViewer, THREE } from "@x-viewer/core";
|
|
2
|
+
/**
|
|
3
|
+
* Default translation snap value, in meter.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const DefaultTranslationSnap = 0.1;
|
|
7
|
+
/**
|
|
8
|
+
* Default rotation snap value, in degree.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const DefaultRotationSnap = 15;
|
|
12
|
+
/**
|
|
13
|
+
* Default scale snap value. in percent.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const DefaultScaleSnap = 0.25;
|
|
17
|
+
/**
|
|
18
|
+
* Used for transform control (gizmo).
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare enum CoordinateSpace {
|
|
22
|
+
Local = "local",
|
|
23
|
+
World = "world"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Transform control mode.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare enum TransformMode {
|
|
30
|
+
Translate = "translate",
|
|
31
|
+
Rotate = "rotate",
|
|
32
|
+
Scale = "scale"
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare enum SnapType {
|
|
38
|
+
None = 0,
|
|
39
|
+
Floor = 1,
|
|
40
|
+
Wall = 2,
|
|
41
|
+
Entity = 4,
|
|
42
|
+
All = 65535
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Snap config
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export interface SnapConfig {
|
|
49
|
+
snapEnabled?: boolean;
|
|
50
|
+
snapType?: SnapType;
|
|
51
|
+
snapRadius?: number;
|
|
52
|
+
gizmoTranslationSnap?: number;
|
|
53
|
+
gizmoScaleSnap?: number;
|
|
54
|
+
gizmoRotationSnap?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare class Gizmo {
|
|
60
|
+
private viewer;
|
|
61
|
+
private scene;
|
|
62
|
+
private transformControl;
|
|
63
|
+
private dragStartPosition;
|
|
64
|
+
private dragStartRotation;
|
|
65
|
+
private dragStartScale;
|
|
66
|
+
private entity;
|
|
67
|
+
active: boolean;
|
|
68
|
+
private space;
|
|
69
|
+
private snapConfig;
|
|
70
|
+
private isShiftPressing;
|
|
71
|
+
constructor(viewer: BaseViewer);
|
|
72
|
+
attach(entity: THREE.Object3D): void;
|
|
73
|
+
detach(): void;
|
|
74
|
+
isActive(): boolean;
|
|
75
|
+
private keyDownEvent;
|
|
76
|
+
private keyUpEvent;
|
|
77
|
+
private changedEvent;
|
|
78
|
+
private draggingStartEvent;
|
|
79
|
+
private draggingEvent;
|
|
80
|
+
private draggingEndEvent;
|
|
81
|
+
/**
|
|
82
|
+
* Enables or disable snap.
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
enableSnap(enabled: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Is snap enabled.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
isSnapEnabled(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Gets transform coordinate space, which should be "local" or "world".
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
getSpace(): CoordinateSpace;
|
|
96
|
+
/**
|
|
97
|
+
* Sets transform coordinate space, which should be "local" or "world".
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
setSpace(space: CoordinateSpace): void;
|
|
101
|
+
/**
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
getTransformMode(): TransformMode;
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
setTransformMode(mode: TransformMode): void;
|
|
109
|
+
/**
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
getTranslationSnap(): number;
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
setTranslationSnap(snap: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
getRotationSnap(): number;
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
setRotationSnap(snap: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
getScaleSnap(): number;
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
setScaleSnap(snap: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* Set snap config.
|
|
135
|
+
*/
|
|
136
|
+
getSnapConfig(): SnapConfig;
|
|
137
|
+
/**
|
|
138
|
+
* Set snap config.
|
|
139
|
+
*/
|
|
140
|
+
setSnapConfig(config: SnapConfig): void;
|
|
141
|
+
destroy(): void;
|
|
142
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { THREE } from "@x-viewer/core";
|
|
2
|
+
export type TransformControlsMode = "translate" | "rotate" | "scale";
|
|
3
|
+
export type PropertyName = "camera" | "object" | "enabled" | "axis" | "mode" | "translationSnap" | "rotationSnap" | "scaleSnap" | "space" | "size" | "dragging" | "showX" | "showY" | "showZ" | "minX" | "maxX" | "minY" | "maxY" | "minZ" | "maxZ" | "worldPosition" | "worldPositionStart" | "worldQuaternion" | "worldQuaternionStart" | "cameraPosition" | "cameraQuaternion" | "pointStart" | "pointEnd" | "rotationAxis" | "rotationAngle" | "eye";
|
|
4
|
+
export type EventName = "camera-changed" | "object-changed" | "enabled-changed" | "axis-changed" | "mode-changed" | "translationSnap-changed" | "rotationSnap-changed" | "scaleSnap-changed" | "space-changed" | "size-changed" | "dragging-changed" | "showX-changed" | "showY-changed" | "showZ-changed" | "minX-changed" | "maxX-changed" | "minY-changed" | "maxY-changed" | "minZ-changed" | "maxZ-changed" | "worldPosition-changed" | "worldPositionStart-changed" | "worldQuaternion-changed" | "worldQuaternionStart-changed" | "cameraPosition-changed" | "cameraQuaternion-changed" | "pointStart-changed" | "pointEnd-changed" | "rotationAxis-changed" | "rotationAngle-changed" | "eye-changed";
|
|
5
|
+
export interface TransformControlsEventMap {
|
|
6
|
+
/**
|
|
7
|
+
* Fires if any type of change (object or property change) is performed. Property changes are separate events you
|
|
8
|
+
* can add event listeners to. The event type is "propertyname-changed".
|
|
9
|
+
*/
|
|
10
|
+
change: object;
|
|
11
|
+
/**
|
|
12
|
+
* Fires if a pointer (mouse/touch) becomes active.
|
|
13
|
+
*/
|
|
14
|
+
mouseDown: {
|
|
15
|
+
mode: TransformControlsMode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Fires if a pointer (mouse/touch) is no longer active.
|
|
19
|
+
*/
|
|
20
|
+
mouseUp: {
|
|
21
|
+
mode: TransformControlsMode;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Fires if the controlled 3D object is changed.
|
|
25
|
+
*/
|
|
26
|
+
objectChange: object;
|
|
27
|
+
/**
|
|
28
|
+
* start dragging.
|
|
29
|
+
*/
|
|
30
|
+
draggingStart: object;
|
|
31
|
+
/**
|
|
32
|
+
* dragging.
|
|
33
|
+
*/
|
|
34
|
+
dragging: object;
|
|
35
|
+
/**
|
|
36
|
+
* end dragging.
|
|
37
|
+
*/
|
|
38
|
+
draggingEnd: object;
|
|
39
|
+
"camera-changed": {
|
|
40
|
+
value: unknown;
|
|
41
|
+
};
|
|
42
|
+
"object-changed": {
|
|
43
|
+
value: unknown;
|
|
44
|
+
};
|
|
45
|
+
"enabled-changed": {
|
|
46
|
+
value: unknown;
|
|
47
|
+
};
|
|
48
|
+
"axis-changed": {
|
|
49
|
+
value: unknown;
|
|
50
|
+
};
|
|
51
|
+
"mode-changed": {
|
|
52
|
+
value: unknown;
|
|
53
|
+
};
|
|
54
|
+
"translationSnap-changed": {
|
|
55
|
+
value: unknown;
|
|
56
|
+
};
|
|
57
|
+
"rotationSnap-changed": {
|
|
58
|
+
value: unknown;
|
|
59
|
+
};
|
|
60
|
+
"scaleSnap-changed": {
|
|
61
|
+
value: unknown;
|
|
62
|
+
};
|
|
63
|
+
"space-changed": {
|
|
64
|
+
value: unknown;
|
|
65
|
+
};
|
|
66
|
+
"size-changed": {
|
|
67
|
+
value: unknown;
|
|
68
|
+
};
|
|
69
|
+
"dragging-changed": {
|
|
70
|
+
value: unknown;
|
|
71
|
+
};
|
|
72
|
+
"showX-changed": {
|
|
73
|
+
value: unknown;
|
|
74
|
+
};
|
|
75
|
+
"showY-changed": {
|
|
76
|
+
value: unknown;
|
|
77
|
+
};
|
|
78
|
+
"showZ-changed": {
|
|
79
|
+
value: unknown;
|
|
80
|
+
};
|
|
81
|
+
"minX-changed": {
|
|
82
|
+
value: unknown;
|
|
83
|
+
};
|
|
84
|
+
"maxX-changed": {
|
|
85
|
+
value: unknown;
|
|
86
|
+
};
|
|
87
|
+
"minY-changed": {
|
|
88
|
+
value: unknown;
|
|
89
|
+
};
|
|
90
|
+
"maxY-changed": {
|
|
91
|
+
value: unknown;
|
|
92
|
+
};
|
|
93
|
+
"minZ-changed": {
|
|
94
|
+
value: unknown;
|
|
95
|
+
};
|
|
96
|
+
"maxZ-changed": {
|
|
97
|
+
value: unknown;
|
|
98
|
+
};
|
|
99
|
+
"worldPosition-changed": {
|
|
100
|
+
value: unknown;
|
|
101
|
+
};
|
|
102
|
+
"worldPositionStart-changed": {
|
|
103
|
+
value: unknown;
|
|
104
|
+
};
|
|
105
|
+
"worldQuaternion-changed": {
|
|
106
|
+
value: unknown;
|
|
107
|
+
};
|
|
108
|
+
"worldQuaternionStart-changed": {
|
|
109
|
+
value: unknown;
|
|
110
|
+
};
|
|
111
|
+
"cameraPosition-changed": {
|
|
112
|
+
value: unknown;
|
|
113
|
+
};
|
|
114
|
+
"cameraQuaternion-changed": {
|
|
115
|
+
value: unknown;
|
|
116
|
+
};
|
|
117
|
+
"pointStart-changed": {
|
|
118
|
+
value: unknown;
|
|
119
|
+
};
|
|
120
|
+
"pointEnd-changed": {
|
|
121
|
+
value: unknown;
|
|
122
|
+
};
|
|
123
|
+
"rotationAxis-changed": {
|
|
124
|
+
value: unknown;
|
|
125
|
+
};
|
|
126
|
+
"rotationAngle-changed": {
|
|
127
|
+
value: unknown;
|
|
128
|
+
};
|
|
129
|
+
"eye-changed": {
|
|
130
|
+
value: unknown;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* This class can be used to transform objects in 3D space by adapting a similar interaction model of DCC tools like
|
|
135
|
+
* Blender. Unlike other controls, it is not intended to transform the scene's camera.
|
|
136
|
+
*
|
|
137
|
+
* TransformControls expects that its attached 3D object is part of the scene graph.
|
|
138
|
+
*/
|
|
139
|
+
declare class TransformControls extends THREE.Controls<TransformControlsEventMap> {
|
|
140
|
+
object: any;
|
|
141
|
+
enabled: any;
|
|
142
|
+
camera: any;
|
|
143
|
+
axis: "X" | "Y" | "Z" | "E" | "XY" | "YZ" | "XZ" | "XYZ" | "XYZE" | null;
|
|
144
|
+
mode: any;
|
|
145
|
+
translationSnap: any;
|
|
146
|
+
rotationSnap: any;
|
|
147
|
+
scaleSnap: any;
|
|
148
|
+
space: any;
|
|
149
|
+
size: any;
|
|
150
|
+
dragging: any;
|
|
151
|
+
showX: any;
|
|
152
|
+
showY: any;
|
|
153
|
+
showZ: any;
|
|
154
|
+
minX: any;
|
|
155
|
+
maxX: any;
|
|
156
|
+
minY: any;
|
|
157
|
+
maxY: any;
|
|
158
|
+
minZ: any;
|
|
159
|
+
maxZ: any;
|
|
160
|
+
worldPosition: any;
|
|
161
|
+
worldPositionStart: any;
|
|
162
|
+
worldQuaternion: any;
|
|
163
|
+
worldQuaternionStart: any;
|
|
164
|
+
cameraPosition: any;
|
|
165
|
+
cameraQuaternion: any;
|
|
166
|
+
pointStart: any;
|
|
167
|
+
pointEnd: any;
|
|
168
|
+
rotationAxis: any;
|
|
169
|
+
rotationAngle: any;
|
|
170
|
+
eye: any;
|
|
171
|
+
_root: any;
|
|
172
|
+
_gizmo: any;
|
|
173
|
+
_plane: any;
|
|
174
|
+
_offset: any;
|
|
175
|
+
_startNorm: any;
|
|
176
|
+
_endNorm: any;
|
|
177
|
+
_cameraScale: any;
|
|
178
|
+
_parentPosition: any;
|
|
179
|
+
_parentQuaternion: any;
|
|
180
|
+
_parentQuaternionInv: any;
|
|
181
|
+
_parentScale: any;
|
|
182
|
+
_worldScaleStart: any;
|
|
183
|
+
_worldQuaternionInv: any;
|
|
184
|
+
_worldScale: any;
|
|
185
|
+
_positionStart: any;
|
|
186
|
+
_quaternionStart: any;
|
|
187
|
+
_scaleStart: any;
|
|
188
|
+
_getPointer: any;
|
|
189
|
+
_onPointerDown: any;
|
|
190
|
+
_onPointerHover: any;
|
|
191
|
+
_onPointerMove: any;
|
|
192
|
+
_onPointerUp: any;
|
|
193
|
+
constructor(camera: any, domElement?: any);
|
|
194
|
+
connect(): void;
|
|
195
|
+
disconnect(): void;
|
|
196
|
+
getHelper(): any;
|
|
197
|
+
pointerHover(pointer: any): void;
|
|
198
|
+
pointerDown(pointer: any): void;
|
|
199
|
+
pointerMove(pointer: any): void;
|
|
200
|
+
pointerUp(pointer: any): void;
|
|
201
|
+
dispose(): void;
|
|
202
|
+
attach(object: THREE.Object3D): this;
|
|
203
|
+
detach(): this;
|
|
204
|
+
reset(): void;
|
|
205
|
+
getRaycaster(): THREE.Raycaster;
|
|
206
|
+
getMode(): any;
|
|
207
|
+
setMode(mode: any): void;
|
|
208
|
+
setTranslationSnap(translationSnap: any): void;
|
|
209
|
+
setRotationSnap(rotationSnap: any): void;
|
|
210
|
+
setScaleSnap(scaleSnap: any): void;
|
|
211
|
+
setSize(size: any): void;
|
|
212
|
+
setSpace(space: any): void;
|
|
213
|
+
}
|
|
214
|
+
declare class TransformControlsGizmo extends THREE.Object3D {
|
|
215
|
+
object: any;
|
|
216
|
+
enabled: any;
|
|
217
|
+
camera: any;
|
|
218
|
+
axis: any;
|
|
219
|
+
mode: any;
|
|
220
|
+
translationSnap: any;
|
|
221
|
+
rotationSnap: any;
|
|
222
|
+
scaleSnap: any;
|
|
223
|
+
space: any;
|
|
224
|
+
size: any;
|
|
225
|
+
dragging: any;
|
|
226
|
+
showX: any;
|
|
227
|
+
showY: any;
|
|
228
|
+
showZ: any;
|
|
229
|
+
minX: any;
|
|
230
|
+
maxX: any;
|
|
231
|
+
minY: any;
|
|
232
|
+
maxY: any;
|
|
233
|
+
minZ: any;
|
|
234
|
+
maxZ: any;
|
|
235
|
+
worldPosition: any;
|
|
236
|
+
worldPositionStart: any;
|
|
237
|
+
worldQuaternion: any;
|
|
238
|
+
worldQuaternionStart: any;
|
|
239
|
+
cameraPosition: any;
|
|
240
|
+
cameraQuaternion: any;
|
|
241
|
+
pointStart: any;
|
|
242
|
+
pointEnd: any;
|
|
243
|
+
rotationAxis: any;
|
|
244
|
+
rotationAngle: any;
|
|
245
|
+
eye: any;
|
|
246
|
+
isTransformControlsGizmo: any;
|
|
247
|
+
readonly type: string;
|
|
248
|
+
gizmo: any;
|
|
249
|
+
picker: any;
|
|
250
|
+
helper: any;
|
|
251
|
+
constructor();
|
|
252
|
+
updateMatrixWorld(force: boolean): void;
|
|
253
|
+
}
|
|
254
|
+
declare class TransformControlsPlane extends THREE.Mesh {
|
|
255
|
+
object: any;
|
|
256
|
+
enabled: any;
|
|
257
|
+
camera: any;
|
|
258
|
+
axis: any;
|
|
259
|
+
mode: any;
|
|
260
|
+
translationSnap: any;
|
|
261
|
+
rotationSnap: any;
|
|
262
|
+
scaleSnap: any;
|
|
263
|
+
space: any;
|
|
264
|
+
size: any;
|
|
265
|
+
dragging: any;
|
|
266
|
+
showX: any;
|
|
267
|
+
showY: any;
|
|
268
|
+
showZ: any;
|
|
269
|
+
minX: any;
|
|
270
|
+
maxX: any;
|
|
271
|
+
minY: any;
|
|
272
|
+
maxY: any;
|
|
273
|
+
minZ: any;
|
|
274
|
+
maxZ: any;
|
|
275
|
+
worldPosition: any;
|
|
276
|
+
worldPositionStart: any;
|
|
277
|
+
worldQuaternion: any;
|
|
278
|
+
worldQuaternionStart: any;
|
|
279
|
+
cameraPosition: any;
|
|
280
|
+
cameraQuaternion: any;
|
|
281
|
+
pointStart: any;
|
|
282
|
+
pointEnd: any;
|
|
283
|
+
rotationAxis: any;
|
|
284
|
+
rotationAngle: any;
|
|
285
|
+
eye: any;
|
|
286
|
+
isTransformControlsPlane: boolean;
|
|
287
|
+
readonly type: string;
|
|
288
|
+
constructor();
|
|
289
|
+
updateMatrixWorld(force: boolean): void;
|
|
290
|
+
}
|
|
291
|
+
export { TransformControls, TransformControlsGizmo, TransformControlsPlane };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Editor";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Drawable, EventInfo, InputManager, Interaction, THREE } from "@x-viewer/core";
|
|
2
|
+
import { Object2dDrawable } from "../drawables/Object2dDrawable";
|
|
3
|
+
import type { EditorViewer2d } from "../viewers/EditorViewer2d";
|
|
4
|
+
export declare class BaseDrawInteraction extends Interaction {
|
|
5
|
+
inputManager: InputManager;
|
|
6
|
+
viewer: EditorViewer2d;
|
|
7
|
+
currentMousePoint: THREE.Vector2;
|
|
8
|
+
currentPoints: THREE.Vector3[];
|
|
9
|
+
mouseMoved: boolean;
|
|
10
|
+
drawStarted: boolean;
|
|
11
|
+
isDrawing: boolean;
|
|
12
|
+
clickLimit: number;
|
|
13
|
+
hostObject?: Object2dDrawable;
|
|
14
|
+
currentDrawingDrawable?: Drawable;
|
|
15
|
+
drawAssetId: string;
|
|
16
|
+
drawConfig: any;
|
|
17
|
+
constructor(viewer: EditorViewer2d, drawConfig: any);
|
|
18
|
+
handle_pointerdown(e: EventInfo): void;
|
|
19
|
+
handle_pointermove(e: EventInfo): void;
|
|
20
|
+
handle_pointerup(e: EventInfo): void;
|
|
21
|
+
getCurrentPoints(): THREE.Vector3[];
|
|
22
|
+
getCurrentMousePoint(): THREE.Vector2;
|
|
23
|
+
showHostObject(e: EventInfo): void;
|
|
24
|
+
removeHostObject(): void;
|
|
25
|
+
setHostObject(object: Object2dDrawable): void;
|
|
26
|
+
getHostObject(): Object2dDrawable | undefined;
|
|
27
|
+
handleMouseRightClick(e: EventInfo): void;
|
|
28
|
+
drawStart(e: EventInfo): void;
|
|
29
|
+
drawing(e: EventInfo): void;
|
|
30
|
+
drawEnd(e: EventInfo): void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EventInfo, InputManager } from "@x-viewer/core";
|
|
2
|
+
import { BaseDrawInteraction } from "./BaseDrawInteraction";
|
|
3
|
+
import { Object2dDrawable } from "../drawables/Object2dDrawable";
|
|
4
|
+
import type { EditorViewer2d } from "../viewers/EditorViewer2d";
|
|
5
|
+
export declare class DrawObject2dInteraction extends BaseDrawInteraction {
|
|
6
|
+
inputManager: InputManager;
|
|
7
|
+
viewer: EditorViewer2d;
|
|
8
|
+
clickLimit: number;
|
|
9
|
+
lastDrawable?: Object2dDrawable;
|
|
10
|
+
currentDrawingDrawable?: Object2dDrawable;
|
|
11
|
+
constructor(viewer: EditorViewer2d, drawConfig: any);
|
|
12
|
+
drawStart(e: EventInfo): void;
|
|
13
|
+
drawing(e: EventInfo): void;
|
|
14
|
+
drawEnd(e: EventInfo): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventInfo, InputManager } from "@x-viewer/core";
|
|
2
|
+
import { BaseDrawInteraction } from "./BaseDrawInteraction";
|
|
3
|
+
import { Room2dDrawable } from "../drawables/Room2dDrawable";
|
|
4
|
+
import type { EditorViewer2d } from "../viewers/EditorViewer2d";
|
|
5
|
+
export declare class DrawWall2dInteraction extends BaseDrawInteraction {
|
|
6
|
+
inputManager: InputManager;
|
|
7
|
+
viewer: EditorViewer2d;
|
|
8
|
+
clickLimit: number;
|
|
9
|
+
lastDrawable?: Room2dDrawable;
|
|
10
|
+
currentDrawingDrawable?: Room2dDrawable;
|
|
11
|
+
constructor(viewer: EditorViewer2d, drawConfig: any);
|
|
12
|
+
handle_pointerup(e: EventInfo): void;
|
|
13
|
+
drawStart(e: EventInfo): void;
|
|
14
|
+
drawing(e: EventInfo): void;
|
|
15
|
+
drawEnd(e: EventInfo): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Drawable, EventInfo, InputManager, Interaction } from "@x-viewer/core";
|
|
2
|
+
import type { EditorViewer2d } from "../viewers/EditorViewer2d";
|
|
3
|
+
export declare class Editor2dInteraction extends Interaction {
|
|
4
|
+
inputManager: InputManager;
|
|
5
|
+
viewer: EditorViewer2d;
|
|
6
|
+
mouseDowned: boolean;
|
|
7
|
+
dragStarted: boolean;
|
|
8
|
+
lastDrawable?: Drawable;
|
|
9
|
+
selectedDrawable?: Drawable;
|
|
10
|
+
selectedWallPointIndex: number;
|
|
11
|
+
selectedWallEdgeIndex: number;
|
|
12
|
+
constructor(viewer: EditorViewer2d);
|
|
13
|
+
handle_pointerdown(e: EventInfo): void;
|
|
14
|
+
handle_pointermove(e: EventInfo): void;
|
|
15
|
+
handle_pointerup(e: EventInfo): void;
|
|
16
|
+
dragStart(e: EventInfo): void;
|
|
17
|
+
dragging(e: EventInfo): void;
|
|
18
|
+
dragEnd(e: EventInfo): void;
|
|
19
|
+
selectDrawable(e: EventInfo): void;
|
|
20
|
+
hoverObject(e: EventInfo): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventInfo, InputManager, Interaction, THREE } from "@x-viewer/core";
|
|
2
|
+
import { Gizmo } from "../gizmo/Gizmo";
|
|
3
|
+
import type { EditorViewer3d } from "../viewers/EditorViewer3d";
|
|
4
|
+
export declare class Editor3dInteraction extends Interaction {
|
|
5
|
+
inputManager: InputManager;
|
|
6
|
+
interactionObject?: THREE.Object3D;
|
|
7
|
+
edgeMesh?: THREE.BoxHelper;
|
|
8
|
+
gizmo?: Gizmo;
|
|
9
|
+
constructor(viewer: EditorViewer3d);
|
|
10
|
+
handle_pointerdown(e: EventInfo): void;
|
|
11
|
+
handle_pointermove(e: EventInfo): void;
|
|
12
|
+
handle_pointerup(e: EventInfo): void;
|
|
13
|
+
private showGizmo;
|
|
14
|
+
private hideGizmo;
|
|
15
|
+
private initGizmo;
|
|
16
|
+
private gizmoDragging;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseViewer, Drawable, DrawableList, THREE } from "@x-viewer/core";
|
|
2
|
+
export declare class EditorViewer2d extends BaseViewer {
|
|
3
|
+
groundPlane: THREE.Mesh;
|
|
4
|
+
drawList: DrawableList;
|
|
5
|
+
constructor(viewerCfg: any);
|
|
6
|
+
protected initEvents(): void;
|
|
7
|
+
private setDefaultBackground;
|
|
8
|
+
/**
|
|
9
|
+
* Gets if selection is enabled.
|
|
10
|
+
*/
|
|
11
|
+
get enableSelection(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Sets if selection is enabled.
|
|
14
|
+
*/
|
|
15
|
+
set enableSelection(enable: boolean);
|
|
16
|
+
addDrawable(drawable: Drawable): void;
|
|
17
|
+
removeDrawable(drawable: Drawable): void;
|
|
18
|
+
loadModel(): Promise<void>;
|
|
19
|
+
initGroundPlane(): void;
|
|
20
|
+
pickPosition(vec2: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
}): THREE.Vector3 | undefined;
|
|
24
|
+
setDrawMode(mode: string, drawConfig: any): void;
|
|
25
|
+
exitDrawMode(): void;
|
|
26
|
+
setObjectHighlight(object: THREE.Object3D): void;
|
|
27
|
+
clearHighlight(): void;
|
|
28
|
+
}
|