viral-viewer-2 6.0.9 → 6.1.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/dist/components/event-handler/keyboard/viral-keyboard.d.ts +17 -0
- package/dist/components/event-handler/keyboard/viral-keyboard.js +76 -0
- package/dist/components/event-handler/keyboard/viral-keyboard.js.map +1 -0
- package/dist/components/event-handler/mouse/viral-mouse.d.ts +31 -0
- package/dist/components/event-handler/mouse/viral-mouse.js +234 -0
- package/dist/components/event-handler/mouse/viral-mouse.js.map +1 -0
- package/dist/gui/context-menu/viral-context-menu.d.ts +17 -0
- package/dist/gui/context-menu/viral-context-menu.js +74 -0
- package/dist/gui/context-menu/viral-context-menu.js.map +1 -0
- package/dist/gui/navigation-cube/components/cube-camera.d.ts +15 -0
- package/dist/gui/navigation-cube/components/cube-camera.js +74 -0
- package/dist/gui/navigation-cube/components/cube-camera.js.map +1 -0
- package/dist/gui/navigation-cube/components/cube-renderer.d.ts +9 -0
- package/dist/gui/navigation-cube/components/cube-renderer.js +31 -0
- package/dist/gui/navigation-cube/components/cube-renderer.js.map +1 -0
- package/dist/gui/navigation-cube/components/cube-scene.d.ts +13 -0
- package/dist/gui/navigation-cube/components/cube-scene.js +546 -0
- package/dist/gui/navigation-cube/components/cube-scene.js.map +1 -0
- package/dist/gui/navigation-cube/components/cube.mouse.d.ts +9 -0
- package/dist/gui/navigation-cube/components/cube.mouse.js +109 -0
- package/dist/gui/navigation-cube/components/cube.mouse.js.map +1 -0
- package/dist/gui/navigation-cube/viral-navigation-cube.d.ts +16 -0
- package/dist/gui/navigation-cube/viral-navigation-cube.js +50 -0
- package/dist/gui/navigation-cube/viral-navigation-cube.js.map +1 -0
- package/dist/gui/tools/tools/viral-tool-ambient-occlusion.d.ts +7 -0
- package/dist/gui/tools/tools/viral-tool-ambient-occlusion.js +16 -0
- package/dist/gui/tools/tools/viral-tool-ambient-occlusion.js.map +1 -0
- package/dist/gui/tools/tools/viral-tool-dark-mode.d.ts +7 -0
- package/dist/gui/tools/tools/viral-tool-dark-mode.js +21 -0
- package/dist/gui/tools/tools/viral-tool-dark-mode.js.map +1 -0
- package/dist/gui/tools/tools/viral-tool-elevation.d.ts +11 -0
- package/dist/gui/tools/tools/viral-tool-elevation.js +30 -0
- package/dist/gui/tools/tools/viral-tool-elevation.js.map +1 -0
- package/dist/gui/tools/tools/viral-tool-measure.d.ts +33 -0
- package/dist/gui/tools/tools/viral-tool-measure.js +243 -0
- package/dist/gui/tools/tools/viral-tool-measure.js.map +1 -0
- package/dist/gui/tools/tools/viral-tool-sunlight.d.ts +7 -0
- package/dist/gui/tools/tools/viral-tool-sunlight.js +46 -0
- package/dist/gui/tools/tools/viral-tool-sunlight.js.map +1 -0
- package/dist/gui/tools/viral-tools.d.ts +32 -0
- package/dist/gui/tools/viral-tools.js +213 -0
- package/dist/gui/tools/viral-tools.js.map +1 -0
- package/dist/viral-viewer-api.d.ts +7 -5
- package/dist/viral-viewer-api.js +7 -5
- package/dist/viral-viewer-api.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ViralKeyboardEventType, ViralViewerApi } from "../../..";
|
|
2
|
+
export declare class ViralKeyboard {
|
|
3
|
+
viralViewerApi: ViralViewerApi;
|
|
4
|
+
constructor(viralViewerApi: ViralViewerApi);
|
|
5
|
+
private setupKeyPress;
|
|
6
|
+
private keydownQueuedEvents;
|
|
7
|
+
private keyupQueuedEvents;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param type Mouse type event
|
|
11
|
+
* @param key key of action
|
|
12
|
+
* @param resolve callback
|
|
13
|
+
*/
|
|
14
|
+
addEventListener(type: ViralKeyboardEventType, key: string, resolve: (evt: KeyboardEvent) => void): void;
|
|
15
|
+
removeEventListener(type: ViralKeyboardEventType, key: string): void;
|
|
16
|
+
getAllEventListener(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViralKeyboard = void 0;
|
|
4
|
+
const __1 = require("../../..");
|
|
5
|
+
class ViralKeyboard {
|
|
6
|
+
constructor(viralViewerApi) {
|
|
7
|
+
this.viralViewerApi = viralViewerApi;
|
|
8
|
+
//#region Event Handler
|
|
9
|
+
this.keydownQueuedEvents = [];
|
|
10
|
+
this.keyupQueuedEvents = [];
|
|
11
|
+
this.setupKeyPress();
|
|
12
|
+
}
|
|
13
|
+
setupKeyPress() {
|
|
14
|
+
document.addEventListener("keydown", (event) => {
|
|
15
|
+
if (this.keydownQueuedEvents.length > 0) {
|
|
16
|
+
this.keydownQueuedEvents.forEach((element) => {
|
|
17
|
+
const [actionKey, callbackResolve] = element;
|
|
18
|
+
callbackResolve(event);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#region Tools
|
|
22
|
+
if (this.viralViewerApi.viralTools.viralToolMeasure.isActivated) {
|
|
23
|
+
this.viralViewerApi.viralTools.viralToolMeasure.onKeyPress(event);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
});
|
|
27
|
+
document.addEventListener("keyup", (event) => {
|
|
28
|
+
if (this.keyupQueuedEvents.length > 0) {
|
|
29
|
+
this.keyupQueuedEvents.forEach((element) => {
|
|
30
|
+
const [actionKey, callbackResolve] = element;
|
|
31
|
+
callbackResolve(event);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#region Tools
|
|
35
|
+
if (this.viralViewerApi.viralTools.viralToolMeasure.isActivated) {
|
|
36
|
+
this.viralViewerApi.viralTools.viralToolMeasure.onKeyPress(event);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param type Mouse type event
|
|
44
|
+
* @param key key of action
|
|
45
|
+
* @param resolve callback
|
|
46
|
+
*/
|
|
47
|
+
addEventListener(type, key, resolve) {
|
|
48
|
+
switch (type) {
|
|
49
|
+
case __1.ViralKeyboardEventType.KEYDOWN:
|
|
50
|
+
this.keydownQueuedEvents.push([key, resolve]);
|
|
51
|
+
break;
|
|
52
|
+
case __1.ViralKeyboardEventType.KEYUP:
|
|
53
|
+
this.keyupQueuedEvents.push([key, resolve]);
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
removeEventListener(type, key) {
|
|
60
|
+
switch (type) {
|
|
61
|
+
case __1.ViralKeyboardEventType.KEYDOWN:
|
|
62
|
+
{
|
|
63
|
+
let index = this.keydownQueuedEvents.findIndex((x) => x[0] == key);
|
|
64
|
+
this.keydownQueuedEvents.splice(index, 1);
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
getAllEventListener() {
|
|
72
|
+
console.log(this.keydownQueuedEvents);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.ViralKeyboard = ViralKeyboard;
|
|
76
|
+
//# sourceMappingURL=viral-keyboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viral-keyboard.js","sourceRoot":"","sources":["../../../../src/components/event-handler/keyboard/viral-keyboard.ts"],"names":[],"mappings":";;;AAAA,gCAAkE;AAElE,MAAa,aAAa;IACxB,YAAmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAiCjD,uBAAuB;QACf,wBAAmB,GAA6C,EAAE,CAAC;QACnE,sBAAiB,GAA6C,EAAE,CAAC;QAlCvE,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAEO,aAAa;QACnB,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAoB,EAAE,EAAE;YAC5D,IAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;gBACv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AC/B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5C,MAAM;YACR;gBACE,MAAM;SACT;IACH,CAAC;IAEM,mBAAmB,CAAC,IAA4B,EAAE,GAAW;QAClE,QAAQ,IAAI,EAAE;YACZ,KAAK,0BAAsB,CAAC,OAAO;gBACjC;oBACE,IAAI,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;oBACnE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;iBAC3C;gBACD,MAAM;YACR;gBACE,MAAM;SACT;IACH,CAAC;IAEM,mBAAmB;QACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;CAEF;AA9ED,sCA8EC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Vector2 } from "three";
|
|
2
|
+
import { ViralViewerApi } from "../../../viral-viewer-api";
|
|
3
|
+
import { ViralMouseEventType } from "../../../types";
|
|
4
|
+
export declare class ViralMouse {
|
|
5
|
+
viralViewerApi: ViralViewerApi;
|
|
6
|
+
position: Vector2;
|
|
7
|
+
rawPosition: Vector2;
|
|
8
|
+
private mouseMoveQueuedEvents;
|
|
9
|
+
private mouseDownLeftQueuedEvents;
|
|
10
|
+
private mouseUpLeftQueuedEvents;
|
|
11
|
+
private mouseDownRightQueuedEvents;
|
|
12
|
+
private mouseUpRightQueuedEvents;
|
|
13
|
+
constructor(viralViewerApi: ViralViewerApi);
|
|
14
|
+
private setupMousePositionUpdate;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param type Mouse type event
|
|
18
|
+
* @param key key of action
|
|
19
|
+
* @param resolve callback
|
|
20
|
+
*/
|
|
21
|
+
addEventListener(type: ViralMouseEventType, key: string, resolve: (result: any) => void): void;
|
|
22
|
+
removeEventListener(type: ViralMouseEventType, key: string): void;
|
|
23
|
+
getAllEventListener(): void;
|
|
24
|
+
private hoverMeshes;
|
|
25
|
+
private hover;
|
|
26
|
+
private reverseColor;
|
|
27
|
+
private setupMouseDown;
|
|
28
|
+
private handleClick;
|
|
29
|
+
private setupMouseUp;
|
|
30
|
+
private handleMouseUp;
|
|
31
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ViralMouse = void 0;
|
|
13
|
+
const three_1 = require("three");
|
|
14
|
+
const types_1 = require("../../../types");
|
|
15
|
+
class ViralMouse {
|
|
16
|
+
constructor(viralViewerApi) {
|
|
17
|
+
this.viralViewerApi = viralViewerApi;
|
|
18
|
+
this.position = new three_1.Vector2();
|
|
19
|
+
this.rawPosition = new three_1.Vector2();
|
|
20
|
+
this.mouseMoveQueuedEvents = [];
|
|
21
|
+
this.mouseDownLeftQueuedEvents = [];
|
|
22
|
+
this.mouseUpLeftQueuedEvents = [];
|
|
23
|
+
this.mouseDownRightQueuedEvents = [];
|
|
24
|
+
this.mouseUpRightQueuedEvents = [];
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region Hover
|
|
27
|
+
this.hoverMeshes = [];
|
|
28
|
+
this.handleClick = (_event) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (this.viralViewerApi) {
|
|
31
|
+
if (_event.button == 0) {
|
|
32
|
+
if (this.mouseDownLeftQueuedEvents.length > 0) {
|
|
33
|
+
this.mouseDownLeftQueuedEvents.forEach(element => {
|
|
34
|
+
const [actionKey, callbackResolve] = element;
|
|
35
|
+
callbackResolve(_event);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
let result = this.viralViewerApi.viralCamera.clientToWorld();
|
|
39
|
+
// console.log(result)
|
|
40
|
+
if (result && result.length > 0) {
|
|
41
|
+
let object = this.viralViewerApi.viralScene.getObjectByName("Viral Pivot Point");
|
|
42
|
+
if (object) {
|
|
43
|
+
object.position.copy(result[0].point);
|
|
44
|
+
object.visible = true;
|
|
45
|
+
}
|
|
46
|
+
this.viralViewerApi.viralRenderer.render();
|
|
47
|
+
(_a = this.viralViewerApi.viralCamera.camera) === null || _a === void 0 ? void 0 : _a.updateMatrixWorld();
|
|
48
|
+
(_b = this.viralViewerApi.viralCamera.cameraControls) === null || _b === void 0 ? void 0 : _b.setOrbitPoint(result[0].point.x, result[0].point.y, result[0].point.z);
|
|
49
|
+
//#region Tools
|
|
50
|
+
if (this.viralViewerApi.viralTools.viralToolMeasure.isActivated) {
|
|
51
|
+
this.viralViewerApi.viralTools.viralToolMeasure.onMouseClick(this.position);
|
|
52
|
+
}
|
|
53
|
+
if (this.viralViewerApi.viralTools.viralToolElevation.isActivated) {
|
|
54
|
+
this.viralViewerApi.viralTools.viralToolElevation.onMouseClick(this.position);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (_event.button == 2) {
|
|
60
|
+
if (this.mouseDownRightQueuedEvents.length > 0) {
|
|
61
|
+
this.mouseDownRightQueuedEvents.forEach(element => {
|
|
62
|
+
const [actionKey, callbackResolve] = element;
|
|
63
|
+
callbackResolve(_event);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
this.handleMouseUp = (_event) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
if (this.viralViewerApi) {
|
|
71
|
+
if (_event.button == 0) {
|
|
72
|
+
let object = this.viralViewerApi.viralScene.getObjectByName("Viral Pivot Point");
|
|
73
|
+
if (object) {
|
|
74
|
+
object.visible = false;
|
|
75
|
+
}
|
|
76
|
+
if (this.mouseUpLeftQueuedEvents.length > 0) {
|
|
77
|
+
this.mouseUpLeftQueuedEvents.forEach(element => {
|
|
78
|
+
const [actionKey, callbackResolve] = element;
|
|
79
|
+
callbackResolve(_event);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (_event.button == 2) {
|
|
84
|
+
if (this.mouseUpRightQueuedEvents.length > 0) {
|
|
85
|
+
this.mouseUpRightQueuedEvents.forEach(element => {
|
|
86
|
+
const [actionKey, callbackResolve] = element;
|
|
87
|
+
callbackResolve(_event);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
this.setupMousePositionUpdate(this.viralViewerApi.viralRenderer.renderer.domElement);
|
|
94
|
+
this.setupMouseDown(this.viralViewerApi.viralRenderer.renderer.domElement);
|
|
95
|
+
this.setupMouseUp(this.viralViewerApi.viralRenderer.renderer.domElement);
|
|
96
|
+
}
|
|
97
|
+
setupMousePositionUpdate(domElement) {
|
|
98
|
+
domElement.onmousemove = (event) => {
|
|
99
|
+
this.rawPosition.x = event.clientX;
|
|
100
|
+
this.rawPosition.y = event.clientY;
|
|
101
|
+
const bounds = domElement.getBoundingClientRect();
|
|
102
|
+
// this.position.x = ((event.clientX - bounds.left) / (bounds.right - bounds.left)) * 2 - 1;
|
|
103
|
+
// this.position.y = -((event.clientY - bounds.top) / (bounds.bottom - bounds.top)) * 2 + 1;
|
|
104
|
+
// this.position.x = ((event.clientX - bounds.left) / (bounds.width)) * 2 - 1;
|
|
105
|
+
// this.position.y = -((event.clientY - bounds.top) / (bounds.height)) * 2 + 1;
|
|
106
|
+
this.position.x = ((event.clientX - bounds.left) / (bounds.width - bounds.left)) * 2 - 1;
|
|
107
|
+
this.position.y = -((event.clientY - bounds.top) / (bounds.bottom - bounds.top)) * 2 + 1;
|
|
108
|
+
// this.hover();
|
|
109
|
+
if (this.mouseMoveQueuedEvents.length > 0) {
|
|
110
|
+
this.mouseMoveQueuedEvents.forEach(element => {
|
|
111
|
+
const [actionKey, callbackResolve] = element;
|
|
112
|
+
callbackResolve(this.position);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//#region Tools
|
|
116
|
+
if (this.viralViewerApi.viralTools.viralToolElevation.isActivated) {
|
|
117
|
+
this.viralViewerApi.viralTools.viralToolElevation.onMouseMove(this.position);
|
|
118
|
+
}
|
|
119
|
+
if (this.viralViewerApi.viralTools.viralToolMeasure.isActivated) {
|
|
120
|
+
this.viralViewerApi.viralTools.viralToolMeasure.onMouseMove(this.position);
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//#region Mouse Event Handler
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
* @param type Mouse type event
|
|
129
|
+
* @param key key of action
|
|
130
|
+
* @param resolve callback
|
|
131
|
+
*/
|
|
132
|
+
addEventListener(type, key, resolve) {
|
|
133
|
+
switch (type) {
|
|
134
|
+
case types_1.ViralMouseEventType.ON_MOUSE_MOVE:
|
|
135
|
+
this.mouseMoveQueuedEvents.push([key, resolve]);
|
|
136
|
+
break;
|
|
137
|
+
case types_1.ViralMouseEventType.ON_MOUSE_DOWN_LEFT:
|
|
138
|
+
this.mouseDownLeftQueuedEvents.push([key, resolve]);
|
|
139
|
+
break;
|
|
140
|
+
case types_1.ViralMouseEventType.ON_MOUSE_UP_LEFT:
|
|
141
|
+
this.mouseUpLeftQueuedEvents.push([key, resolve]);
|
|
142
|
+
break;
|
|
143
|
+
case types_1.ViralMouseEventType.ON_MOUSE_DOWN_RIGHT:
|
|
144
|
+
this.mouseDownRightQueuedEvents.push([key, resolve]);
|
|
145
|
+
break;
|
|
146
|
+
case types_1.ViralMouseEventType.ON_MOUSE_UP_RIGHT:
|
|
147
|
+
this.mouseUpRightQueuedEvents.push([key, resolve]);
|
|
148
|
+
break;
|
|
149
|
+
default:
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
removeEventListener(type, key) {
|
|
154
|
+
switch (type) {
|
|
155
|
+
case types_1.ViralMouseEventType.ON_MOUSE_MOVE:
|
|
156
|
+
{
|
|
157
|
+
let index = this.mouseMoveQueuedEvents.findIndex(x => x[0] == key);
|
|
158
|
+
this.mouseMoveQueuedEvents.splice(index, 1);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
case types_1.ViralMouseEventType.ON_MOUSE_DOWN_LEFT:
|
|
162
|
+
{
|
|
163
|
+
let index = this.mouseDownLeftQueuedEvents.findIndex(x => x[0] == key);
|
|
164
|
+
this.mouseDownLeftQueuedEvents.splice(index, 1);
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
case types_1.ViralMouseEventType.ON_MOUSE_UP_LEFT:
|
|
168
|
+
{
|
|
169
|
+
let index = this.mouseUpLeftQueuedEvents.findIndex(x => x[0] == key);
|
|
170
|
+
this.mouseUpLeftQueuedEvents.splice(index, 1);
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
case types_1.ViralMouseEventType.ON_MOUSE_DOWN_RIGHT:
|
|
174
|
+
{
|
|
175
|
+
let index = this.mouseDownRightQueuedEvents.findIndex(x => x[0] == key);
|
|
176
|
+
this.mouseDownRightQueuedEvents.splice(index, 1);
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case types_1.ViralMouseEventType.ON_MOUSE_UP_RIGHT:
|
|
180
|
+
{
|
|
181
|
+
let index = this.mouseUpRightQueuedEvents.findIndex(x => x[0] == key);
|
|
182
|
+
this.mouseUpRightQueuedEvents.splice(index, 1);
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
getAllEventListener() {
|
|
190
|
+
console.log(this.mouseMoveQueuedEvents);
|
|
191
|
+
console.log(this.mouseUpLeftQueuedEvents);
|
|
192
|
+
console.log(this.mouseDownLeftQueuedEvents);
|
|
193
|
+
console.log(this.mouseUpRightQueuedEvents);
|
|
194
|
+
console.log(this.mouseDownRightQueuedEvents);
|
|
195
|
+
}
|
|
196
|
+
hover() {
|
|
197
|
+
if (this.viralViewerApi) {
|
|
198
|
+
let result = this.viralViewerApi.viralCamera.clientToWorld();
|
|
199
|
+
if (result && result.length > 0) {
|
|
200
|
+
let mesh = result[0];
|
|
201
|
+
if (mesh.object instanceof three_1.Mesh) {
|
|
202
|
+
mesh.object.material.userData.oldColor = mesh.object.material.color;
|
|
203
|
+
mesh.object.material.color.set(Math.random() * 0xffffff);
|
|
204
|
+
this.hoverMeshes.push(mesh.object);
|
|
205
|
+
this.viralViewerApi.viralRenderer.render();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
this.reverseColor();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
reverseColor() {
|
|
213
|
+
if (this.hoverMeshes.length == 0)
|
|
214
|
+
return;
|
|
215
|
+
for (let index = 0; index < this.hoverMeshes.length; index++) {
|
|
216
|
+
const element = this.hoverMeshes[index];
|
|
217
|
+
element.material.color.set(element.material.userData.oldColor);
|
|
218
|
+
}
|
|
219
|
+
this.hoverMeshes = [];
|
|
220
|
+
this.viralViewerApi.viralRenderer.render();
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region Mouse Down
|
|
224
|
+
setupMouseDown(domElement) {
|
|
225
|
+
domElement.onmousedown = this.handleClick;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region Mouse Up
|
|
229
|
+
setupMouseUp(domElement) {
|
|
230
|
+
domElement.onmouseup = this.handleMouseUp;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
exports.ViralMouse = ViralMouse;
|
|
234
|
+
//# sourceMappingURL=viral-mouse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viral-mouse.js","sourceRoot":"","sources":["../../../../src/components/event-handler/mouse/viral-mouse.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAsC;AAEtC,0CAAqD;AAErD,MAAa,UAAU;IASnB,YAAmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QARjD,aAAQ,GAAG,IAAI,eAAO,EAAE,CAAC;QACzB,gBAAW,GAAG,IAAI,eAAO,EAAE,CAAC;QACpB,0BAAqB,GAAsC,EAAE,CAAC;QAC9D,8BAAyB,GAAsC,EAAE,CAAC;QAClE,4BAAuB,GAAsC,EAAE,CAAC;QAChE,+BAA0B,GAAsC,EAAE,CAAC;QACnE,6BAAwB,GAAsC,EAAE,CAAC;QAmHzE,YAAY;QAEZ,eAAe;QACP,gBAAW,GAAqB,EAAE,CAAC;QAoCnC,gBAAW,GAAG,CAAO,MAAkB,EAAE,EAAE;;YAC/C,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;oBACpB,IAAI,IAAI,CAAC,yBAAyB,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC3C,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;4BAC7C,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,OAAO,CAAC;4BAC7C,eAAe,CAAC,MAAM,CAAC,CAAC;wBAC5B,CAAC,CAAC,CAAC;qBACN;oBACD,IAAI,MAAM,GAAG,IAAI,CAAC,cAA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AAM,CAAC,CAAC;oBACnC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;oBAC3C,OAAO;iBACV;aACJ;YACD,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;IACL,CAAC;IAEO,YAAY;QAChB,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO;QACzC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAElE;QACD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC/C,CAAC;IAED,YAAY;IAEZ,oBAAoB;IACZ,cAAc,CAAC,UAAuB;QAC1C,UAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IAE/C,CAAC;IA+CD,YAAY;IAEZ,kBAAkB;IACV,YAAY,CAAC,UAAuB;QACxC,UAAW,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC;IAE/C,CAAC;CA6BJ;AAlPD,gCAkPC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ViralViewerApi } from "../../viral-viewer-api";
|
|
2
|
+
export declare class ViralContextMenu {
|
|
3
|
+
viralViewerApi: ViralViewerApi;
|
|
4
|
+
private contextMenu;
|
|
5
|
+
private contextItems;
|
|
6
|
+
constructor(viralViewerApi: ViralViewerApi);
|
|
7
|
+
private injectContextMenu;
|
|
8
|
+
showContextMenu(top: number, left: number, itemKeys: number[]): void;
|
|
9
|
+
hideContextMenu(): void;
|
|
10
|
+
private initContent;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param itemName
|
|
14
|
+
* @param resolve callback when user click
|
|
15
|
+
*/
|
|
16
|
+
addContextItem(itemKey: number, itemName: string, resolve: (result: any) => void): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViralContextMenu = void 0;
|
|
4
|
+
const colors_1 = require("../../const/colors");
|
|
5
|
+
const html_1 = require("../../utils/html");
|
|
6
|
+
class ViralContextMenu {
|
|
7
|
+
constructor(viralViewerApi) {
|
|
8
|
+
this.viralViewerApi = viralViewerApi;
|
|
9
|
+
this.contextMenu = null;
|
|
10
|
+
this.contextItems = [];
|
|
11
|
+
this.injectContextMenu();
|
|
12
|
+
}
|
|
13
|
+
injectContextMenu() {
|
|
14
|
+
const hoverEffect = `
|
|
15
|
+
.hover-element {
|
|
16
|
+
transition: background-color 0.3s ease;
|
|
17
|
+
}
|
|
18
|
+
.hover-element:hover {
|
|
19
|
+
background-color: ${colors_1.LightTheme.primary};
|
|
20
|
+
|
|
21
|
+
}`;
|
|
22
|
+
// Create a style element and append the keyframes animation
|
|
23
|
+
const style = document.createElement("style");
|
|
24
|
+
style.innerHTML = hoverEffect;
|
|
25
|
+
// Append the style element to the document head
|
|
26
|
+
document.head.appendChild(style);
|
|
27
|
+
if (this.viralViewerApi.targetElement) {
|
|
28
|
+
this.contextMenu = document.createElement("div");
|
|
29
|
+
this.contextMenu.setAttribute("style", `position: absolute;top:0px;left:0px;background-color: ${colors_1.LightTheme.background};justify-content: center;display:none; z-index: 100; flex-direction:column; padding: 10px 0; border-radius:10px`);
|
|
30
|
+
this.viralViewerApi.targetElement.appendChild(this.contextMenu);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
showContextMenu(top, left, itemKeys) {
|
|
34
|
+
if (this.contextMenu) {
|
|
35
|
+
this.initContent(itemKeys);
|
|
36
|
+
this.contextMenu.style.setProperty("display", "flex");
|
|
37
|
+
this.contextMenu.style.setProperty("top", `${top}px`);
|
|
38
|
+
this.contextMenu.style.setProperty("left", `${left}px`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
hideContextMenu() {
|
|
42
|
+
if (this.contextMenu) {
|
|
43
|
+
this.contextMenu.style.setProperty("display", "none");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
initContent(itemKeys) {
|
|
47
|
+
var _a;
|
|
48
|
+
while (this.contextMenu && this.contextMenu.firstChild) {
|
|
49
|
+
this.contextMenu.removeChild(this.contextMenu.firstChild);
|
|
50
|
+
}
|
|
51
|
+
for (let index = 0; index < this.contextItems.length; index++) {
|
|
52
|
+
if (itemKeys.findIndex((x) => x == this.contextItems[index][0]) < 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const [itemKey, itemName, callbackResolve] = this.contextItems[index];
|
|
56
|
+
const item = html_1.HTMLUtil.createElementFromHTML(`<div class="hover-element" style="padding: 5px 10px; cursor: pointer; color:#666">${itemName}</div>`);
|
|
57
|
+
item.addEventListener("click", (ev) => {
|
|
58
|
+
ev.stopPropagation();
|
|
59
|
+
callbackResolve(ev);
|
|
60
|
+
});
|
|
61
|
+
(_a = this.contextMenu) === null || _a === void 0 ? void 0 : _a.appendChild(item);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param itemName
|
|
67
|
+
* @param resolve callback when user click
|
|
68
|
+
*/
|
|
69
|
+
addContextItem(itemKey, itemName, resolve) {
|
|
70
|
+
this.contextItems.push([itemKey, itemName, resolve]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.ViralContextMenu = ViralContextMenu;
|
|
74
|
+
//# sourceMappingURL=viral-context-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viral-context-menu.js","sourceRoot":"","sources":["../../../src/g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CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC;CACF;AAhFD,4CAgFC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import CameraControls from "camera-controls";
|
|
2
|
+
import { Vector3, PerspectiveCamera } from 'three';
|
|
3
|
+
import { ViralNavigationCube } from "../viral-navigation-cube";
|
|
4
|
+
export declare class CubeCamera {
|
|
5
|
+
viralNavigationCube: ViralNavigationCube;
|
|
6
|
+
camera: PerspectiveCamera | null;
|
|
7
|
+
cameraControls: CameraControls | null;
|
|
8
|
+
cameraControlOldPosition: Vector3;
|
|
9
|
+
cameraControlNewPosition: Vector3;
|
|
10
|
+
cameraControlHasMoved: boolean;
|
|
11
|
+
constructor(viralNavigationCube: ViralNavigationCube);
|
|
12
|
+
setupCamera(): void;
|
|
13
|
+
updateCubeCamera(): void;
|
|
14
|
+
setupHandle(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CubeCamera = void 0;
|
|
4
|
+
const camera_controls_1 = require("camera-controls");
|
|
5
|
+
const three_1 = require("three");
|
|
6
|
+
const subsetOfTHREE = {
|
|
7
|
+
Vector2: three_1.Vector2,
|
|
8
|
+
Vector3: three_1.Vector3,
|
|
9
|
+
Vector4: three_1.Vector4,
|
|
10
|
+
Quaternion: three_1.Quaternion,
|
|
11
|
+
Matrix4: three_1.Matrix4,
|
|
12
|
+
Spherical: three_1.Spherical,
|
|
13
|
+
Box3: three_1.Box3,
|
|
14
|
+
Sphere: three_1.Sphere,
|
|
15
|
+
Raycaster: three_1.Raycaster,
|
|
16
|
+
MathUtils: three_1.MathUtils,
|
|
17
|
+
};
|
|
18
|
+
class CubeCamera {
|
|
19
|
+
constructor(viralNavigationCube) {
|
|
20
|
+
this.viralNavigationCube = viralNavigationCube;
|
|
21
|
+
this.camera = null;
|
|
22
|
+
this.cameraControls = null;
|
|
23
|
+
this.cameraControlOldPosition = new three_1.Vector3();
|
|
24
|
+
this.cameraControlNewPosition = new three_1.Vector3();
|
|
25
|
+
this.cameraControlHasMoved = false;
|
|
26
|
+
this.setupCamera();
|
|
27
|
+
this.setupHandle();
|
|
28
|
+
}
|
|
29
|
+
setupCamera() {
|
|
30
|
+
if (this.viralNavigationCube.targetElement && this.viralNavigationCube.cubeRenderer) {
|
|
31
|
+
const width = this.viralNavigationCube.targetElement.offsetWidth;
|
|
32
|
+
const height = this.viralNavigationCube.targetElement.offsetHeight;
|
|
33
|
+
this.camera = new three_1.PerspectiveCamera(60, width / height, 0.01, 100);
|
|
34
|
+
this.camera.position.set(0, 0, 2);
|
|
35
|
+
camera_controls_1.default.install({ THREE: subsetOfTHREE });
|
|
36
|
+
this.cameraControls = new camera_controls_1.default(this.camera, this.viralNavigationCube.cubeRenderer.renderer.domElement);
|
|
37
|
+
this.cameraControls.dollyToCursor = false;
|
|
38
|
+
this.cameraControls.infinityDolly = false;
|
|
39
|
+
this.cameraControls.setTarget(0, 0, 0);
|
|
40
|
+
this.cameraControls.polarRotateSpeed = 0.15;
|
|
41
|
+
this.cameraControls.azimuthRotateSpeed = 0.15;
|
|
42
|
+
this.cameraControls.mouseButtons.middle = camera_controls_1.default.ACTION.NONE;
|
|
43
|
+
this.cameraControls.mouseButtons.wheel = camera_controls_1.default.ACTION.NONE;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
updateCubeCamera() {
|
|
47
|
+
var _a;
|
|
48
|
+
let cameraControlTarget = new three_1.Vector3();
|
|
49
|
+
this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls.getTarget(cameraControlTarget);
|
|
50
|
+
let cameraControlPosition = new three_1.Vector3();
|
|
51
|
+
this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls.getPosition(cameraControlPosition);
|
|
52
|
+
//Hieu 2 vector
|
|
53
|
+
let vector = cameraControlPosition.sub(cameraControlTarget);
|
|
54
|
+
//Chuan hoa
|
|
55
|
+
vector.normalize();
|
|
56
|
+
//Do lon vector bang 2
|
|
57
|
+
vector.multiplyScalar(2);
|
|
58
|
+
(_a = this.cameraControls) === null || _a === void 0 ? void 0 : _a.setPosition(vector.x, vector.y, vector.z);
|
|
59
|
+
}
|
|
60
|
+
setupHandle() {
|
|
61
|
+
function antiMoveOnDown(e) {
|
|
62
|
+
this.cameraControlHasMoved = false;
|
|
63
|
+
}
|
|
64
|
+
function antiMoveOnMove(e) {
|
|
65
|
+
this.cameraControlHasMoved = true;
|
|
66
|
+
}
|
|
67
|
+
window.addEventListener('mousedown', antiMoveOnDown, false);
|
|
68
|
+
window.addEventListener('mousemove', antiMoveOnMove, false);
|
|
69
|
+
window.addEventListener('touchstart', antiMoveOnDown, false);
|
|
70
|
+
window.addEventListener('touchmove', antiMoveOnMove, true);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.CubeCamera = CubeCamera;
|
|
74
|
+
//# sourceMappingURL=cube-camera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cube-camera.js","sourceRoot":"","sources":["../../../../src/gui/navigation-cube/components/cube-camera.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAC7C,iCAae;AAEf,MAAM,aAAa,GAAG;IAClB,OAAO,EAAE,eAAO;IAChB,OAAO,EAAE,eAAO;IAChB,OAAO,EAAE,eAAO;IAChB,UAAU,EAAE,kBAAU;IACtB,OAAO,EAAE,eAAO;IAChB,SAAS,EAAE,iBAAS;IACpB,IAAI,EAAE,YAAI;IACV,MAAM,EAAE,cAAM;IACd,SAAS,EAAE,iBAAS;IACpB,SAAS,EAAE,iBAAS;CACvB,CAAC;AAEF,MAAa,UAAU;IAMnB,YAAmB,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAL3D,WAAM,GAA6B,IAAI,CAAC;QACxC,mBAAc,GAA0B,IAAI,CAAC;QAC7C,6BAAwB,GAAY,IAA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C,WAAW,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC/D,CAAC;CAEJ;AAzDD,gCAyDC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebGLRenderer } from "three";
|
|
2
|
+
import { ViralNavigationCube } from "../viral-navigation-cube";
|
|
3
|
+
export declare class CubeRenderer {
|
|
4
|
+
viralNavigationCube: ViralNavigationCube;
|
|
5
|
+
renderer: WebGLRenderer;
|
|
6
|
+
constructor(viralNavigationCube: ViralNavigationCube);
|
|
7
|
+
setupRenderer(): void;
|
|
8
|
+
render(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CubeRenderer = void 0;
|
|
4
|
+
const three_1 = require("three");
|
|
5
|
+
class CubeRenderer {
|
|
6
|
+
constructor(viralNavigationCube) {
|
|
7
|
+
this.viralNavigationCube = viralNavigationCube;
|
|
8
|
+
// clock: Clock = new Clock();
|
|
9
|
+
this.renderer = new three_1.WebGLRenderer({
|
|
10
|
+
alpha: true,
|
|
11
|
+
antialias: true,
|
|
12
|
+
logarithmicDepthBuffer: true,
|
|
13
|
+
});
|
|
14
|
+
this.setupRenderer();
|
|
15
|
+
}
|
|
16
|
+
setupRenderer() {
|
|
17
|
+
if (this.viralNavigationCube.targetElement) {
|
|
18
|
+
this.renderer.setClearColor(0x000000, 0);
|
|
19
|
+
this.renderer.setSize(this.viralNavigationCube.targetElement.offsetWidth, this.viralNavigationCube.targetElement.offsetHeight);
|
|
20
|
+
this.viralNavigationCube.targetElement.appendChild(this.renderer.domElement);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
if (this.viralNavigationCube.cubeScene && this.viralNavigationCube.cubeCamera && this.viralNavigationCube.cubeCamera.camera) {
|
|
25
|
+
this.viralNavigationCube.cubeCamera.camera.updateMatrixWorld(true);
|
|
26
|
+
this.renderer.render(this.viralNavigationCube.cubeScene.scene, this.viralNavigationCube.cubeCamera.camera);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.CubeRenderer = CubeRenderer;
|
|
31
|
+
//# sourceMappingURL=cube-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cube-renderer.js","sourceRoot":"","sources":["../../../../src/gui/navigation-cube/components/cube-renderer.ts"],"names":[],"mappings":";;;AAAA,iCAA6C;AAG7C,MAAa,YAAY;IAOrB,YAAmB,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAN3D,8BAA8B;QAC9B,aAAQ,GAAkB,IAAI,qBAAa,CAAC;YACxC,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,IAAI;YACf,sBAAsB,EAAE,IAAI;SAC/B,CAAC,CAAC;QAEC,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IACM,aAAa;QAChB,IAAI,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE;YACxC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YAC/H,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAEhF;IAEL,CAAC;IACM,MAAM;QACT,IAAI,IAAI,CAAC,mBAAmB,CAAC,SAAS,IAAI,IAAI,CAAC,mBAAmB,CAAC,UAAU,IAAI,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,EAAE;YACzH,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACnE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SAC9G;IAGL,CAAC;CAmBJ;AA7CD,oCA6CC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Scene, Mesh, Object3D, MeshBasicMaterial, BufferGeometry } from 'three';
|
|
2
|
+
import { ViralNavigationCube } from '../viral-navigation-cube';
|
|
3
|
+
export declare class CubeScene {
|
|
4
|
+
viralNavigationCube: ViralNavigationCube;
|
|
5
|
+
scene: Scene;
|
|
6
|
+
objects: Object3D[];
|
|
7
|
+
cube: Mesh | null;
|
|
8
|
+
activePlane: Mesh<BufferGeometry, MeshBasicMaterial> | null;
|
|
9
|
+
constructor(viralNavigationCube: ViralNavigationCube);
|
|
10
|
+
addObject(object: Object3D): void;
|
|
11
|
+
addCube(): void;
|
|
12
|
+
addPlanes(): void;
|
|
13
|
+
}
|