@shapediver/viewer.rendering-engine.intersection-engine 3.14.2 → 3.14.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapediver/viewer.rendering-engine.intersection-engine",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"testEnvironment": "node"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@shapediver/viewer.rendering-engine.rendering-engine": "3.14.
|
|
42
|
-
"@shapediver/viewer.shared.math": "3.14.
|
|
43
|
-
"@shapediver/viewer.shared.node-tree": "3.14.
|
|
44
|
-
"@shapediver/viewer.shared.services": "3.14.
|
|
45
|
-
"@shapediver/viewer.shared.types": "3.14.
|
|
41
|
+
"@shapediver/viewer.rendering-engine.rendering-engine": "3.14.4",
|
|
42
|
+
"@shapediver/viewer.shared.math": "3.14.4",
|
|
43
|
+
"@shapediver/viewer.shared.node-tree": "3.14.4",
|
|
44
|
+
"@shapediver/viewer.shared.services": "3.14.4",
|
|
45
|
+
"@shapediver/viewer.shared.types": "3.14.4",
|
|
46
46
|
"@types/three": "0.162.0",
|
|
47
47
|
"detect-it": "4.0.1",
|
|
48
48
|
"gl-matrix": "3.3.0",
|
|
49
49
|
"three": "0.162.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "0d69a4f3b348579abcd893921bf0c2f39813b0fe"
|
|
52
52
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IRay } from "@shapediver/viewer.shared.types";
|
|
2
|
-
export declare class SelectionBox {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(canvas: HTMLCanvasElement);
|
|
5
|
-
get coordinates(): {
|
|
6
|
-
start: {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
};
|
|
10
|
-
end: {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
};
|
|
14
|
-
} | undefined;
|
|
15
|
-
onDown(event: PointerEvent, ray: IRay): void;
|
|
16
|
-
onEnd(event: PointerEvent, ray: IRay): void;
|
|
17
|
-
onMove(event: PointerEvent, ray: IRay, insertionActive: boolean, removalActive: boolean): void;
|
|
18
|
-
reset(): void;
|
|
19
|
-
private updateSelectionBox;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=BoxSelection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoxSelection.d.ts","sourceRoot":"","sources":["../../src/implementation/BoxSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,iCAAiC,CAAC;AAErD,qBAAa,YAAY;;gBAQZ,MAAM,EAAE,iBAAiB;IAIrC,IAAW,WAAW;;;;;;;;;kBAErB;IAEM,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI;IAgB5C,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI;IAW3C,MAAM,CACZ,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,IAAI,EACT,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,OAAO,GACpB,IAAI;IAYA,KAAK,IAAI,IAAI;IAMpB,OAAO,CAAC,kBAAkB;CAsD1B"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _SelectionBox_canvas, _SelectionBox_htmlElement, _SelectionBox_coordinates;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.SelectionBox = void 0;
|
|
16
|
-
class SelectionBox {
|
|
17
|
-
constructor(canvas) {
|
|
18
|
-
_SelectionBox_canvas.set(this, void 0);
|
|
19
|
-
_SelectionBox_htmlElement.set(this, void 0);
|
|
20
|
-
_SelectionBox_coordinates.set(this, void 0);
|
|
21
|
-
__classPrivateFieldSet(this, _SelectionBox_canvas, canvas, "f");
|
|
22
|
-
}
|
|
23
|
-
get coordinates() {
|
|
24
|
-
return __classPrivateFieldGet(this, _SelectionBox_coordinates, "f");
|
|
25
|
-
}
|
|
26
|
-
onDown(event, ray) {
|
|
27
|
-
const rect = __classPrivateFieldGet(this, _SelectionBox_canvas, "f").getBoundingClientRect();
|
|
28
|
-
const x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
|
|
29
|
-
const y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
|
|
30
|
-
__classPrivateFieldSet(this, _SelectionBox_coordinates, {
|
|
31
|
-
start: {
|
|
32
|
-
x: x,
|
|
33
|
-
y: y,
|
|
34
|
-
},
|
|
35
|
-
end: {
|
|
36
|
-
x: x,
|
|
37
|
-
y: y,
|
|
38
|
-
},
|
|
39
|
-
}, "f");
|
|
40
|
-
}
|
|
41
|
-
onEnd(event, ray) {
|
|
42
|
-
const rect = __classPrivateFieldGet(this, _SelectionBox_canvas, "f").getBoundingClientRect();
|
|
43
|
-
const x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
|
|
44
|
-
const y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
|
|
45
|
-
__classPrivateFieldGet(this, _SelectionBox_coordinates, "f").end = {
|
|
46
|
-
x: x,
|
|
47
|
-
y: y,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
onMove(event, ray, insertionActive, removalActive) {
|
|
51
|
-
// update box selection
|
|
52
|
-
const rect = __classPrivateFieldGet(this, _SelectionBox_canvas, "f").getBoundingClientRect();
|
|
53
|
-
const x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
|
|
54
|
-
const y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
|
|
55
|
-
__classPrivateFieldGet(this, _SelectionBox_coordinates, "f").end = {
|
|
56
|
-
x: x,
|
|
57
|
-
y: y,
|
|
58
|
-
};
|
|
59
|
-
this.updateSelectionBox(insertionActive, removalActive);
|
|
60
|
-
}
|
|
61
|
-
reset() {
|
|
62
|
-
var _a;
|
|
63
|
-
(_a = __classPrivateFieldGet(this, _SelectionBox_htmlElement, "f")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
64
|
-
__classPrivateFieldSet(this, _SelectionBox_htmlElement, undefined, "f");
|
|
65
|
-
__classPrivateFieldSet(this, _SelectionBox_coordinates, undefined, "f");
|
|
66
|
-
}
|
|
67
|
-
updateSelectionBox(insertionActive, removalActive) {
|
|
68
|
-
if (!__classPrivateFieldGet(this, _SelectionBox_coordinates, "f"))
|
|
69
|
-
return;
|
|
70
|
-
let color = "0, 0, 255"; // blue
|
|
71
|
-
if (insertionActive && !removalActive) {
|
|
72
|
-
color = "0, 255, 0"; // green
|
|
73
|
-
}
|
|
74
|
-
else if (!insertionActive && removalActive) {
|
|
75
|
-
color = "255, 0, 0"; // red
|
|
76
|
-
}
|
|
77
|
-
if (!__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f")) {
|
|
78
|
-
// create selection box div
|
|
79
|
-
__classPrivateFieldSet(this, _SelectionBox_htmlElement, document.createElement("div"), "f");
|
|
80
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.position = "absolute";
|
|
81
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.border = `1px solid rgba(${color}, 0.8)`;
|
|
82
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.backgroundColor = `rgba(${color}, 0.1)`;
|
|
83
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.pointerEvents = "none";
|
|
84
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.zIndex = "9999"; // Ensure it's on top
|
|
85
|
-
document.body.appendChild(__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f"));
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
// check if the color needs to be updated
|
|
89
|
-
const currentBorderColor = __classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.border;
|
|
90
|
-
const desiredBorderColor = `1px solid rgba(${color}, 0.8)`;
|
|
91
|
-
if (currentBorderColor !== desiredBorderColor) {
|
|
92
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.border = desiredBorderColor;
|
|
93
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.backgroundColor = `rgba(${color}, 0.1)`;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
const rect = __classPrivateFieldGet(this, _SelectionBox_canvas, "f").getBoundingClientRect();
|
|
97
|
-
// Convert normalized coordinates back to document coordinates
|
|
98
|
-
const convertedStartX = ((__classPrivateFieldGet(this, _SelectionBox_coordinates, "f").start.x + 1) / 2) * rect.width + rect.left;
|
|
99
|
-
const convertedStartY = ((1 - __classPrivateFieldGet(this, _SelectionBox_coordinates, "f").start.y) / 2) * rect.height + rect.top;
|
|
100
|
-
const convertedEndX = ((__classPrivateFieldGet(this, _SelectionBox_coordinates, "f").end.x + 1) / 2) * rect.width + rect.left;
|
|
101
|
-
const convertedEndY = ((1 - __classPrivateFieldGet(this, _SelectionBox_coordinates, "f").end.y) / 2) * rect.height + rect.top;
|
|
102
|
-
const x = Math.min(convertedStartX, convertedEndX);
|
|
103
|
-
const y = Math.min(convertedStartY, convertedEndY);
|
|
104
|
-
const width = Math.abs(convertedEndX - convertedStartX);
|
|
105
|
-
const height = Math.abs(convertedEndY - convertedStartY);
|
|
106
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.left = `${x}px`;
|
|
107
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.top = `${y}px`;
|
|
108
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.width = `${width}px`;
|
|
109
|
-
__classPrivateFieldGet(this, _SelectionBox_htmlElement, "f").style.height = `${height}px`;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.SelectionBox = SelectionBox;
|
|
113
|
-
_SelectionBox_canvas = new WeakMap(), _SelectionBox_htmlElement = new WeakMap(), _SelectionBox_coordinates = new WeakMap();
|
|
114
|
-
//# sourceMappingURL=BoxSelection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoxSelection.js","sourceRoot":"","sources":["../../src/implementation/BoxSelection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,MAAa,YAAY;IAQxB,YAAY,MAAyB;QAPrC,uCAA2B;QAC3B,4CAA8B;QAC9B,4CAGE;QAGD,uBAAA,IAAI,wBAAW,MAAM,MAAA,CAAC;IACvB,CAAC;IAED,IAAW,WAAW;QACrB,OAAO,uBAAA,IAAI,iCAAa,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAC,KAAmB,EAAE,GAAS;QAC3C,MAAM,IAAI,GAAG,uBAAA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