@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.5.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/LICENSE +73 -0
- package/README.md +3 -0
- package/dist/api/implementation/AbstractRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/AbstractRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/AbstractRestrictionApi.js +38 -0
- package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +13 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.js +47 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +7 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js +24 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +15 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js +54 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -0
- package/dist/api/implementation/line/LineRestrictionApi.d.ts +11 -0
- package/dist/api/implementation/line/LineRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/line/LineRestrictionApi.js +40 -0
- package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +20 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.js +67 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js +40 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +7 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js +24 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js +40 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -0
- package/dist/api/implementation/point/PointRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/point/PointRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/point/PointRestrictionApi.js +37 -0
- package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -0
- package/dist/api/interfaces/IRestrictionApi.d.ts +11 -0
- package/dist/api/interfaces/IRestrictionApi.d.ts.map +1 -0
- package/dist/api/interfaces/IRestrictionApi.js +3 -0
- package/dist/api/interfaces/IRestrictionApi.js.map +1 -0
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts +13 -0
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts.map +1 -0
- package/dist/api/interfaces/ISnapRestrictionApi.js +3 -0
- package/dist/api/interfaces/ISnapRestrictionApi.js.map +1 -0
- package/dist/implementation/EventManager.d.ts +26 -0
- package/dist/implementation/EventManager.d.ts.map +1 -0
- package/dist/implementation/EventManager.js +63 -0
- package/dist/implementation/EventManager.js.map +1 -0
- package/dist/implementation/GeometryMathManager.d.ts +82 -0
- package/dist/implementation/GeometryMathManager.d.ts.map +1 -0
- package/dist/implementation/GeometryMathManager.js +240 -0
- package/dist/implementation/GeometryMathManager.js.map +1 -0
- package/dist/implementation/RestrictionManager.d.ts +29 -0
- package/dist/implementation/RestrictionManager.d.ts.map +1 -0
- package/dist/implementation/RestrictionManager.js +220 -0
- package/dist/implementation/RestrictionManager.js.map +1 -0
- package/dist/implementation/restrictions/AbstractRestriction.d.ts +42 -0
- package/dist/implementation/restrictions/AbstractRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/AbstractRestriction.js +130 -0
- package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +32 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.js +125 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -0
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts +11 -0
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -0
- package/dist/implementation/restrictions/RestrictionsHelper.js +47 -0
- package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +19 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +64 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +41 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js +259 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -0
- package/dist/implementation/restrictions/line/LineRestriction.d.ts +28 -0
- package/dist/implementation/restrictions/line/LineRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/line/LineRestriction.js +104 -0
- package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +68 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.js +259 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +41 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +321 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +28 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +172 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +40 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js +211 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -0
- package/dist/implementation/restrictions/point/PointRestriction.d.ts +25 -0
- package/dist/implementation/restrictions/point/PointRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/point/PointRestriction.js +78 -0
- package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IDragAnchor.d.ts +9 -0
- package/dist/interfaces/IDragAnchor.d.ts.map +1 -0
- package/dist/interfaces/IDragAnchor.js +3 -0
- package/dist/interfaces/IDragAnchor.js.map +1 -0
- package/dist/interfaces/IRestriction.d.ts +89 -0
- package/dist/interfaces/IRestriction.d.ts.map +1 -0
- package/dist/interfaces/IRestriction.js +25 -0
- package/dist/interfaces/IRestriction.js.map +1 -0
- package/dist/interfaces/IRestrictionManager.d.ts +14 -0
- package/dist/interfaces/IRestrictionManager.d.ts.map +1 -0
- package/dist/interfaces/IRestrictionManager.js +3 -0
- package/dist/interfaces/IRestrictionManager.js.map +1 -0
- package/dist/interfaces/ISnapRestriction.d.ts +67 -0
- package/dist/interfaces/ISnapRestriction.d.ts.map +1 -0
- package/dist/interfaces/ISnapRestriction.js +4 -0
- package/dist/interfaces/ISnapRestriction.js.map +1 -0
- package/dist/interfaces/IVisualizationSettings.d.ts +33 -0
- package/dist/interfaces/IVisualizationSettings.d.ts.map +1 -0
- package/dist/interfaces/IVisualizationSettings.js +3 -0
- package/dist/interfaces/IVisualizationSettings.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,220 @@
|
|
|
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 _RestrictionManager_eventManager, _RestrictionManager_geometryMathManager, _RestrictionManager_parentNode, _RestrictionManager_restrictions, _RestrictionManager_settings, _RestrictionManager_uuidGenerator, _RestrictionManager_viewport, _RestrictionManager_closed, _RestrictionManager_keysPressed, _RestrictionManager_restrictionManagerNode, _RestrictionManager_showRestrictionVisualization;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RestrictionManager = void 0;
|
|
16
|
+
const RestrictionsHelper_1 = require("./restrictions/RestrictionsHelper");
|
|
17
|
+
const CameraPlaneRestriction_1 = require("./restrictions/camera_plane/CameraPlaneRestriction");
|
|
18
|
+
const IRestriction_1 = require("../interfaces/IRestriction");
|
|
19
|
+
const EventManager_1 = require("./EventManager");
|
|
20
|
+
const GeometryMathManager_1 = require("./GeometryMathManager");
|
|
21
|
+
const GeometryRestriction_1 = require("./restrictions/geometry/GeometryRestriction");
|
|
22
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
23
|
+
const viewer_1 = require("@shapediver/viewer");
|
|
24
|
+
const LineRestriction_1 = require("./restrictions/line/LineRestriction");
|
|
25
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
26
|
+
const PlaneRestriction_1 = require("./restrictions/plane/PlaneRestriction");
|
|
27
|
+
const PointRestriction_1 = require("./restrictions/point/PointRestriction");
|
|
28
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
29
|
+
class RestrictionManager {
|
|
30
|
+
// #endregion Properties (11)
|
|
31
|
+
// #region Constructors (1)
|
|
32
|
+
constructor(viewport, parentNode = viewer_1.sceneTree.root, restrictions, settings) {
|
|
33
|
+
// #region Properties (11)
|
|
34
|
+
_RestrictionManager_eventManager.set(this, void 0);
|
|
35
|
+
_RestrictionManager_geometryMathManager.set(this, void 0);
|
|
36
|
+
_RestrictionManager_parentNode.set(this, void 0);
|
|
37
|
+
_RestrictionManager_restrictions.set(this, {});
|
|
38
|
+
_RestrictionManager_settings.set(this, {
|
|
39
|
+
distanceLabels: true,
|
|
40
|
+
distanceMultiplicationFactor: 2,
|
|
41
|
+
lines: {
|
|
42
|
+
color: '#0d44f0'
|
|
43
|
+
},
|
|
44
|
+
pointLabels: false,
|
|
45
|
+
points: {
|
|
46
|
+
size_0: 15, size_1: 20, size_2: 15, size_3: 20, size_4: 15, size_5: 20,
|
|
47
|
+
color_0: '#0d44f0', color_1: '#197aeb', color_2: '#9e27d8', color_3: '#bc47fd', color_4: '#00ff78', color_5: '#00ff78'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
_RestrictionManager_uuidGenerator.set(this, viewer_shared_services_1.UuidGenerator.instance);
|
|
51
|
+
_RestrictionManager_viewport.set(this, void 0);
|
|
52
|
+
_RestrictionManager_closed.set(this, false);
|
|
53
|
+
_RestrictionManager_keysPressed.set(this, {});
|
|
54
|
+
_RestrictionManager_restrictionManagerNode.set(this, void 0);
|
|
55
|
+
_RestrictionManager_showRestrictionVisualization.set(this, false);
|
|
56
|
+
__classPrivateFieldSet(this, _RestrictionManager_viewport, viewport, "f");
|
|
57
|
+
__classPrivateFieldSet(this, _RestrictionManager_parentNode, parentNode, "f");
|
|
58
|
+
__classPrivateFieldSet(this, _RestrictionManager_restrictionManagerNode, new viewer_shared_node_tree_1.TreeNode('RestrictionManager'), "f");
|
|
59
|
+
__classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").addChild(__classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"));
|
|
60
|
+
__classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").updateVersion(false, false);
|
|
61
|
+
if (settings)
|
|
62
|
+
__classPrivateFieldSet(this, _RestrictionManager_settings, settings, "f");
|
|
63
|
+
__classPrivateFieldSet(this, _RestrictionManager_geometryMathManager, new GeometryMathManager_1.GeometryMathManager(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_settings, "f")), "f");
|
|
64
|
+
__classPrivateFieldSet(this, _RestrictionManager_eventManager, new EventManager_1.EventManager(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), {
|
|
65
|
+
onDown: this.onDown.bind(this),
|
|
66
|
+
onUp: this.onUp.bind(this),
|
|
67
|
+
onOut: this.onOut.bind(this),
|
|
68
|
+
onMove: this.onMove.bind(this),
|
|
69
|
+
onKeyDown: this.onKeyDown.bind(this),
|
|
70
|
+
onKeyUp: this.onKeyUp.bind(this)
|
|
71
|
+
}), "f");
|
|
72
|
+
if (restrictions) {
|
|
73
|
+
for (const r of restrictions) {
|
|
74
|
+
this.addRestriction(r);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// #endregion Constructors (1)
|
|
79
|
+
// #region Public Getters And Setters (4)
|
|
80
|
+
get closed() {
|
|
81
|
+
return __classPrivateFieldGet(this, _RestrictionManager_closed, "f");
|
|
82
|
+
}
|
|
83
|
+
get restrictions() {
|
|
84
|
+
return __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f");
|
|
85
|
+
}
|
|
86
|
+
get showRestrictionVisualization() {
|
|
87
|
+
return __classPrivateFieldGet(this, _RestrictionManager_showRestrictionVisualization, "f");
|
|
88
|
+
}
|
|
89
|
+
set showRestrictionVisualization(value) {
|
|
90
|
+
__classPrivateFieldSet(this, _RestrictionManager_showRestrictionVisualization, value, "f");
|
|
91
|
+
for (const restriction of Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f"))) {
|
|
92
|
+
restriction.showVisualization = value;
|
|
93
|
+
for (const snapRestriction of Object.values(restriction.snapRestrictions)) {
|
|
94
|
+
snapRestriction.showVisualization = value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// #endregion Public Getters And Setters (4)
|
|
99
|
+
// #region Public Methods (6)
|
|
100
|
+
addRestriction(properties) {
|
|
101
|
+
const token = properties.id || __classPrivateFieldGet(this, _RestrictionManager_uuidGenerator, "f").create();
|
|
102
|
+
let restriction;
|
|
103
|
+
if (properties.type === IRestriction_1.RESTRICTION_TYPE.PLANE) {
|
|
104
|
+
restriction = new PlaneRestriction_1.PlaneRestriction(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f"), __classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"), token, __classPrivateFieldGet(this, _RestrictionManager_settings, "f"), properties);
|
|
105
|
+
}
|
|
106
|
+
else if (properties.type === IRestriction_1.RESTRICTION_TYPE.GEOMETRY) {
|
|
107
|
+
restriction = new GeometryRestriction_1.GeometryRestriction(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f"), __classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"), token, __classPrivateFieldGet(this, _RestrictionManager_settings, "f"), properties);
|
|
108
|
+
}
|
|
109
|
+
else if (properties.type === IRestriction_1.RESTRICTION_TYPE.CAMERA_PLANE) {
|
|
110
|
+
restriction = new CameraPlaneRestriction_1.CameraPlaneRestriction(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f"), __classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"), token, __classPrivateFieldGet(this, _RestrictionManager_settings, "f"), properties);
|
|
111
|
+
}
|
|
112
|
+
else if (properties.type === IRestriction_1.RESTRICTION_TYPE.POINT) {
|
|
113
|
+
restriction = new PointRestriction_1.PointRestriction(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f"), __classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"), token, __classPrivateFieldGet(this, _RestrictionManager_settings, "f"), properties);
|
|
114
|
+
}
|
|
115
|
+
else if (properties.type === IRestriction_1.RESTRICTION_TYPE.LINE) {
|
|
116
|
+
restriction = new LineRestriction_1.LineRestriction(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f"), __classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"), token, __classPrivateFieldGet(this, _RestrictionManager_settings, "f"), properties);
|
|
117
|
+
}
|
|
118
|
+
if (restriction) {
|
|
119
|
+
__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token] = restriction;
|
|
120
|
+
return token;
|
|
121
|
+
}
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
close() {
|
|
125
|
+
__classPrivateFieldSet(this, _RestrictionManager_closed, true, "f");
|
|
126
|
+
__classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").removeChild(__classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"));
|
|
127
|
+
__classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").updateVersion(false, false);
|
|
128
|
+
__classPrivateFieldGet(this, _RestrictionManager_eventManager, "f").close();
|
|
129
|
+
__classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f").close();
|
|
130
|
+
Object.keys(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")).forEach(key => this.removeRestriction(key));
|
|
131
|
+
}
|
|
132
|
+
getPressedKeys() {
|
|
133
|
+
return Object.keys(__classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")).filter(key => __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[key] === true);
|
|
134
|
+
}
|
|
135
|
+
getRestriction(token) {
|
|
136
|
+
return __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token];
|
|
137
|
+
}
|
|
138
|
+
rayTrace(ray, metaData) {
|
|
139
|
+
let rayTracingResult = undefined;
|
|
140
|
+
metaData.pressedKeys = this.getPressedKeys();
|
|
141
|
+
// create an array of arrays with the restrictions sorted by priority
|
|
142
|
+
const restrictionsSorted = Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")).sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
|
143
|
+
for (const restriction of restrictionsSorted) {
|
|
144
|
+
if (rayTracingResult && rayTracingResult.restriction.priority > restriction.priority)
|
|
145
|
+
break;
|
|
146
|
+
const hit = restriction.rayTrace(ray, metaData);
|
|
147
|
+
if (!hit)
|
|
148
|
+
continue;
|
|
149
|
+
const distance = hit.distance !== undefined ? hit.distance : gl_matrix_1.vec3.squaredDistance(ray.origin, hit.point);
|
|
150
|
+
if (distance < (rayTracingResult ? rayTracingResult.distance : Infinity)) {
|
|
151
|
+
if ((0, IRestriction_1.isDraggingRestriction)(metaData)) {
|
|
152
|
+
const { matrix, dragAnchor } = (0, RestrictionsHelper_1.calculateDragMatrix)(hit.point, hit.restriction.rotation, metaData.dragOrigin, metaData.dragAnchors, hit.closestPointOnRay || hit.point);
|
|
153
|
+
rayTracingResult = {
|
|
154
|
+
restriction: restriction,
|
|
155
|
+
transformation: matrix,
|
|
156
|
+
dragAnchor: dragAnchor,
|
|
157
|
+
point: hit.point,
|
|
158
|
+
distance: distance
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
rayTracingResult = {
|
|
163
|
+
restriction: restriction,
|
|
164
|
+
point: hit.point,
|
|
165
|
+
distance: distance
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// deactivate the visualization of all restrictions that are not hit
|
|
171
|
+
for (const restriction of Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f"))) {
|
|
172
|
+
if (rayTracingResult && restriction !== rayTracingResult.restriction) {
|
|
173
|
+
for (const snapRestriction of Object.values(restriction.snapRestrictions)) {
|
|
174
|
+
snapRestriction.active = false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return rayTracingResult;
|
|
179
|
+
}
|
|
180
|
+
removeRestriction(token) {
|
|
181
|
+
if (__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token]) {
|
|
182
|
+
Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token].snapRestrictions).forEach(r => r.removeVisualization());
|
|
183
|
+
__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token].removeVisualization();
|
|
184
|
+
delete __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token];
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
// #endregion Public Methods (6)
|
|
190
|
+
// #region Private Methods (6)
|
|
191
|
+
onDown(event, ray) {
|
|
192
|
+
if (this.closed)
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
onKeyDown(event) {
|
|
196
|
+
if (this.closed)
|
|
197
|
+
return;
|
|
198
|
+
__classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[event.key] = true;
|
|
199
|
+
}
|
|
200
|
+
onKeyUp(event) {
|
|
201
|
+
if (this.closed)
|
|
202
|
+
return;
|
|
203
|
+
__classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[event.key] = false;
|
|
204
|
+
}
|
|
205
|
+
onMove(event, ray) {
|
|
206
|
+
if (this.closed)
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
onOut() {
|
|
210
|
+
if (this.closed)
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
onUp() {
|
|
214
|
+
if (this.closed)
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.RestrictionManager = RestrictionManager;
|
|
219
|
+
_RestrictionManager_eventManager = new WeakMap(), _RestrictionManager_geometryMathManager = new WeakMap(), _RestrictionManager_parentNode = new WeakMap(), _RestrictionManager_restrictions = new WeakMap(), _RestrictionManager_settings = new WeakMap(), _RestrictionManager_uuidGenerator = new WeakMap(), _RestrictionManager_viewport = new WeakMap(), _RestrictionManager_closed = new WeakMap(), _RestrictionManager_keysPressed = new WeakMap(), _RestrictionManager_restrictionManagerNode = new WeakMap(), _RestrictionManager_showRestrictionVisualization = new WeakMap();
|
|
220
|
+
//# sourceMappingURL=RestrictionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestrictionManager.js","sourceRoot":"","sources":["../../src/implementation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;YAChD,OAAO,uBAAA,IAAI,wCAAc,CAAC,KAAK,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,gCAAgC;IAEhC,8BAA8B;IAEtB,MAAM,CAAC,KAAmB,EAAE,GAAS;QACzC,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;IAC5B,CAAC;IAEO,SAAS,CAAC,KAAoB;QAClC,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QAExB,uBAAA,IAAI,uCAAa,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC;IAEO,OAAO,CAAC,KAAoB;QAChC,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,uBAAA,IAAI,uCAAa,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,KAAmB,EAAE,GAAS;QACzC,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;IAC5B,CAAC;IAEO,KAAK;QACT,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;IAC5B,CAAC;IAEO,IAAI;QACR,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;IAC5B,CAAC;CAGJ;AAhQD,gDAgQC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
3
|
+
import { IRestriction, RESTRICTION_TYPE, RestrictionMetaData, RestrictionProperties, RestrictionResult } from '../../interfaces/IRestriction';
|
|
4
|
+
import { ISnapRestriction } from '../../interfaces/ISnapRestriction';
|
|
5
|
+
import { ITreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
6
|
+
import { IViewportApi } from '@shapediver/viewer';
|
|
7
|
+
import { vec3 } from 'gl-matrix';
|
|
8
|
+
export declare abstract class AbstractRestriction implements IRestriction {
|
|
9
|
+
#private;
|
|
10
|
+
protected _enabled: boolean;
|
|
11
|
+
protected _enabledEditable: boolean;
|
|
12
|
+
protected _object3D: THREE.Object3D;
|
|
13
|
+
protected _priority: number;
|
|
14
|
+
protected _snapRestrictions: {
|
|
15
|
+
[key: string]: ISnapRestriction;
|
|
16
|
+
};
|
|
17
|
+
constructor(viewport: IViewportApi, parentNode: ITreeNode, id: string, properties: RestrictionProperties);
|
|
18
|
+
get enabled(): boolean;
|
|
19
|
+
set enabled(value: boolean);
|
|
20
|
+
get id(): string;
|
|
21
|
+
get priority(): number;
|
|
22
|
+
set priority(value: number);
|
|
23
|
+
get rotation(): {
|
|
24
|
+
axis: vec3;
|
|
25
|
+
angle: number;
|
|
26
|
+
};
|
|
27
|
+
set rotation(value: {
|
|
28
|
+
axis: vec3;
|
|
29
|
+
angle: number;
|
|
30
|
+
});
|
|
31
|
+
get showVisualization(): boolean;
|
|
32
|
+
set showVisualization(value: boolean);
|
|
33
|
+
get snapRestrictions(): {
|
|
34
|
+
[key: string]: ISnapRestriction;
|
|
35
|
+
};
|
|
36
|
+
get type(): RESTRICTION_TYPE;
|
|
37
|
+
removeVisualization(): void;
|
|
38
|
+
abstract rayTrace(ray: IRay, metaData?: RestrictionMetaData): RestrictionResult | undefined;
|
|
39
|
+
protected abstract visibilityChanged(visible: boolean): void;
|
|
40
|
+
private createGridHelperObject;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=AbstractRestriction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractRestriction.d.ts","sourceRoot":"","sources":["../../../src/implementation/restrictions/AbstractRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EACH,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EA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AgB,CAElC;IAMM,mBAAmB,IAAI,IAAI;aAUlB,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,SAAS;IAMlG,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAM5D,OAAO,CAAC,sBAAsB;CAiBjC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
+
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");
|
|
29
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
+
};
|
|
31
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
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");
|
|
34
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
};
|
|
36
|
+
var _AbstractRestriction_id, _AbstractRestriction_parentNode, _AbstractRestriction_type, _AbstractRestriction_viewport, _AbstractRestriction_visualizationNode, _AbstractRestriction_rotation, _AbstractRestriction_showVisualization;
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.AbstractRestriction = void 0;
|
|
39
|
+
const THREE = __importStar(require("three"));
|
|
40
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
41
|
+
const viewer_rendering_engine_rendering_engine_threejs_1 = require("@shapediver/viewer.rendering-engine.rendering-engine-threejs");
|
|
42
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
43
|
+
class AbstractRestriction {
|
|
44
|
+
// #endregion Properties (12)
|
|
45
|
+
// #region Constructors (1)
|
|
46
|
+
constructor(viewport, parentNode, id, properties) {
|
|
47
|
+
// #region Properties (12)
|
|
48
|
+
_AbstractRestriction_id.set(this, void 0);
|
|
49
|
+
_AbstractRestriction_parentNode.set(this, void 0);
|
|
50
|
+
_AbstractRestriction_type.set(this, void 0);
|
|
51
|
+
_AbstractRestriction_viewport.set(this, void 0);
|
|
52
|
+
_AbstractRestriction_visualizationNode.set(this, new viewer_shared_node_tree_1.TreeNode('RestrictionVisualizationNode'));
|
|
53
|
+
_AbstractRestriction_rotation.set(this, void 0);
|
|
54
|
+
_AbstractRestriction_showVisualization.set(this, false);
|
|
55
|
+
this._enabled = true;
|
|
56
|
+
this._enabledEditable = true;
|
|
57
|
+
this._priority = -1;
|
|
58
|
+
this._snapRestrictions = {};
|
|
59
|
+
__classPrivateFieldSet(this, _AbstractRestriction_parentNode, parentNode, "f");
|
|
60
|
+
__classPrivateFieldSet(this, _AbstractRestriction_viewport, viewport, "f");
|
|
61
|
+
__classPrivateFieldSet(this, _AbstractRestriction_id, id, "f");
|
|
62
|
+
__classPrivateFieldSet(this, _AbstractRestriction_type, properties.type, "f");
|
|
63
|
+
__classPrivateFieldSet(this, _AbstractRestriction_rotation, properties.rotation || { axis: gl_matrix_1.vec3.fromValues(0, 0, 1), angle: 0 }, "f");
|
|
64
|
+
this.createGridHelperObject();
|
|
65
|
+
}
|
|
66
|
+
// #endregion Constructors (1)
|
|
67
|
+
// #region Public Getters And Setters (11)
|
|
68
|
+
get enabled() {
|
|
69
|
+
return this._enabled;
|
|
70
|
+
}
|
|
71
|
+
set enabled(value) {
|
|
72
|
+
if (this._enabledEditable === false)
|
|
73
|
+
return;
|
|
74
|
+
this._enabled = value;
|
|
75
|
+
this.visibilityChanged(this._object3D.visible);
|
|
76
|
+
}
|
|
77
|
+
get id() {
|
|
78
|
+
return __classPrivateFieldGet(this, _AbstractRestriction_id, "f");
|
|
79
|
+
}
|
|
80
|
+
get priority() {
|
|
81
|
+
return this._priority;
|
|
82
|
+
}
|
|
83
|
+
set priority(value) {
|
|
84
|
+
this._priority = value;
|
|
85
|
+
}
|
|
86
|
+
get rotation() {
|
|
87
|
+
return __classPrivateFieldGet(this, _AbstractRestriction_rotation, "f");
|
|
88
|
+
}
|
|
89
|
+
set rotation(value) {
|
|
90
|
+
__classPrivateFieldSet(this, _AbstractRestriction_rotation, value, "f");
|
|
91
|
+
}
|
|
92
|
+
get showVisualization() {
|
|
93
|
+
return __classPrivateFieldGet(this, _AbstractRestriction_showVisualization, "f");
|
|
94
|
+
}
|
|
95
|
+
set showVisualization(value) {
|
|
96
|
+
__classPrivateFieldSet(this, _AbstractRestriction_showVisualization, value, "f");
|
|
97
|
+
this._object3D.visible = value;
|
|
98
|
+
this.visibilityChanged(this._object3D.visible);
|
|
99
|
+
}
|
|
100
|
+
get snapRestrictions() {
|
|
101
|
+
return this._snapRestrictions;
|
|
102
|
+
}
|
|
103
|
+
get type() {
|
|
104
|
+
return __classPrivateFieldGet(this, _AbstractRestriction_type, "f");
|
|
105
|
+
}
|
|
106
|
+
// #endregion Public Getters And Setters (11)
|
|
107
|
+
// #region Public Methods (1)
|
|
108
|
+
removeVisualization() {
|
|
109
|
+
__classPrivateFieldGet(this, _AbstractRestriction_parentNode, "f").removeChild(__classPrivateFieldGet(this, _AbstractRestriction_visualizationNode, "f"));
|
|
110
|
+
__classPrivateFieldGet(this, _AbstractRestriction_parentNode, "f").updateVersion(false, false);
|
|
111
|
+
__classPrivateFieldGet(this, _AbstractRestriction_viewport, "f").updateNode(__classPrivateFieldGet(this, _AbstractRestriction_parentNode, "f"));
|
|
112
|
+
}
|
|
113
|
+
// #endregion Protected Abstract Methods (1)
|
|
114
|
+
// #region Private Methods (1)
|
|
115
|
+
createGridHelperObject() {
|
|
116
|
+
this._object3D = new THREE.Object3D();
|
|
117
|
+
this._object3D.visible = false;
|
|
118
|
+
const node = new viewer_shared_node_tree_1.TreeNode('ThreeJsDataNode');
|
|
119
|
+
const data = new viewer_rendering_engine_rendering_engine_threejs_1.ThreejsData(this._object3D);
|
|
120
|
+
node.addData(data);
|
|
121
|
+
__classPrivateFieldGet(this, _AbstractRestriction_visualizationNode, "f").addChild(node);
|
|
122
|
+
__classPrivateFieldGet(this, _AbstractRestriction_visualizationNode, "f").updateVersion();
|
|
123
|
+
__classPrivateFieldGet(this, _AbstractRestriction_parentNode, "f").addChild(__classPrivateFieldGet(this, _AbstractRestriction_visualizationNode, "f"));
|
|
124
|
+
__classPrivateFieldGet(this, _AbstractRestriction_parentNode, "f").updateVersion(false, false);
|
|
125
|
+
__classPrivateFieldGet(this, _AbstractRestriction_viewport, "f").updateNode(__classPrivateFieldGet(this, _AbstractRestriction_parentNode, "f"));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.AbstractRestriction = AbstractRestriction;
|
|
129
|
+
_AbstractRestriction_id = new WeakMap(), _AbstractRestriction_parentNode = new WeakMap(), _AbstractRestriction_type = new WeakMap(), _AbstractRestriction_viewport = new WeakMap(), _AbstractRestriction_visualizationNode = new WeakMap(), _AbstractRestriction_rotation = new WeakMap(), _AbstractRestriction_showVisualization = new WeakMap();
|
|
130
|
+
//# sourceMappingURL=AbstractRestriction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractRestriction.js","sourceRoot":"","sources":["../../../src/implementation/restrictions/AbstractRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAU/B,iFAA0E;AAE1E,mIAA2F;AAC3F,yCAAiC;AAEjC,MAAsB,mBAAmB;IAkBrC,6BAA6B;IAE7B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,UAAqB,EAAE,EAAU,EAAE,UAAiC;QArBxG,0BAA0B;QAE1B,0CAAqB;QACrB,kDAAgC;QAChC,4CAAiC;QACjC,gDAAiC;QACjC,iDAAwC,IAAI,kCAAQ,CAAC,8BAA8B,CAAC,EAAC;QAErF,gDAA0C;QAC1C,iDAA8B,KAAK,EAAC;QAE1B,aAAQ,GAAY,IAAI,CAAC;QACzB,qBAAgB,GAAY,IAAI,CAAC;QAEjC,cAAS,GAAW,CAAC,CAAC,CAAC;QACvB,sBAAiB,GAAwC,EAAE,CAAC;QAOlE,uBAAA,IAAI,mCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,iCAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,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-0,0 +1,32 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
3
|
+
import { ISnapRestriction } from '../../interfaces/ISnapRestriction';
|
|
4
|
+
import { ITreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
5
|
+
import { IViewportApi } from '@shapediver/viewer';
|
|
6
|
+
import { RestrictionMetaData, RestrictionResult } from '../../interfaces/IRestriction';
|
|
7
|
+
import { vec3 } from 'gl-matrix';
|
|
8
|
+
export declare abstract class AbstractSnapRestriction implements ISnapRestriction {
|
|
9
|
+
#private;
|
|
10
|
+
protected _active: boolean;
|
|
11
|
+
protected _enabled: boolean;
|
|
12
|
+
protected _enabledEditable: boolean;
|
|
13
|
+
protected _object3D: THREE.Object3D;
|
|
14
|
+
protected _priority: number;
|
|
15
|
+
constructor(viewport: IViewportApi, parentNode: ITreeNode, id: string);
|
|
16
|
+
get active(): boolean;
|
|
17
|
+
set active(value: boolean);
|
|
18
|
+
get enabled(): boolean;
|
|
19
|
+
set enabled(value: boolean);
|
|
20
|
+
get enabledEditable(): boolean;
|
|
21
|
+
set enabledEditable(value: boolean);
|
|
22
|
+
get id(): string;
|
|
23
|
+
get priority(): number;
|
|
24
|
+
set priority(value: number);
|
|
25
|
+
get showVisualization(): boolean;
|
|
26
|
+
set showVisualization(value: boolean);
|
|
27
|
+
removeVisualization(): void;
|
|
28
|
+
abstract snap(ray: IRay, point: vec3, metaData?: RestrictionMetaData): RestrictionResult | undefined;
|
|
29
|
+
protected abstract visibilityChanged(visible: boolean): void;
|
|
30
|
+
private createGridHelperObject;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=AbstractSnapRestriction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractSnapRestriction.d.ts","sourceRoot":"","sources":["../../../src/implementation/restrictions/AbstractSnapRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MA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AE,IAAI,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,SAAS;IAM3G,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAM5D,OAAO,CAAC,sBAAsB;CAiBjC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
+
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");
|
|
29
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
+
};
|
|
31
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
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");
|
|
34
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
};
|
|
36
|
+
var _AbstractSnapRestriction_id, _AbstractSnapRestriction_parentNode, _AbstractSnapRestriction_viewport, _AbstractSnapRestriction_visualizationNode, _AbstractSnapRestriction_showVisualization;
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.AbstractSnapRestriction = void 0;
|
|
39
|
+
const THREE = __importStar(require("three"));
|
|
40
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
41
|
+
const viewer_rendering_engine_rendering_engine_threejs_1 = require("@shapediver/viewer.rendering-engine.rendering-engine-threejs");
|
|
42
|
+
class AbstractSnapRestriction {
|
|
43
|
+
// #endregion Properties (10)
|
|
44
|
+
// #region Constructors (1)
|
|
45
|
+
constructor(viewport, parentNode, id) {
|
|
46
|
+
// #region Properties (10)
|
|
47
|
+
_AbstractSnapRestriction_id.set(this, void 0);
|
|
48
|
+
_AbstractSnapRestriction_parentNode.set(this, void 0);
|
|
49
|
+
_AbstractSnapRestriction_viewport.set(this, void 0);
|
|
50
|
+
_AbstractSnapRestriction_visualizationNode.set(this, new viewer_shared_node_tree_1.TreeNode('RestrictionVisualizationNode'));
|
|
51
|
+
_AbstractSnapRestriction_showVisualization.set(this, false);
|
|
52
|
+
this._active = false;
|
|
53
|
+
this._enabled = true;
|
|
54
|
+
this._enabledEditable = true;
|
|
55
|
+
this._priority = 0;
|
|
56
|
+
__classPrivateFieldSet(this, _AbstractSnapRestriction_parentNode, parentNode, "f");
|
|
57
|
+
__classPrivateFieldSet(this, _AbstractSnapRestriction_viewport, viewport, "f");
|
|
58
|
+
__classPrivateFieldSet(this, _AbstractSnapRestriction_id, id, "f");
|
|
59
|
+
this.createGridHelperObject();
|
|
60
|
+
}
|
|
61
|
+
// #endregion Constructors (1)
|
|
62
|
+
// #region Public Getters And Setters (11)
|
|
63
|
+
get active() {
|
|
64
|
+
return this._active;
|
|
65
|
+
}
|
|
66
|
+
set active(value) {
|
|
67
|
+
this._active = value;
|
|
68
|
+
}
|
|
69
|
+
get enabled() {
|
|
70
|
+
return this._enabled;
|
|
71
|
+
}
|
|
72
|
+
set enabled(value) {
|
|
73
|
+
if (this._enabledEditable === false)
|
|
74
|
+
return;
|
|
75
|
+
this._enabled = value;
|
|
76
|
+
this.visibilityChanged(this._object3D.visible);
|
|
77
|
+
}
|
|
78
|
+
get enabledEditable() {
|
|
79
|
+
return this._enabledEditable;
|
|
80
|
+
}
|
|
81
|
+
set enabledEditable(value) {
|
|
82
|
+
this._enabledEditable = value;
|
|
83
|
+
}
|
|
84
|
+
get id() {
|
|
85
|
+
return __classPrivateFieldGet(this, _AbstractSnapRestriction_id, "f");
|
|
86
|
+
}
|
|
87
|
+
get priority() {
|
|
88
|
+
return this._priority;
|
|
89
|
+
}
|
|
90
|
+
set priority(value) {
|
|
91
|
+
this._priority = value;
|
|
92
|
+
}
|
|
93
|
+
get showVisualization() {
|
|
94
|
+
return __classPrivateFieldGet(this, _AbstractSnapRestriction_showVisualization, "f");
|
|
95
|
+
}
|
|
96
|
+
set showVisualization(value) {
|
|
97
|
+
__classPrivateFieldSet(this, _AbstractSnapRestriction_showVisualization, value, "f");
|
|
98
|
+
this._object3D.visible = value;
|
|
99
|
+
this.visibilityChanged(this._object3D.visible);
|
|
100
|
+
}
|
|
101
|
+
// #endregion Public Getters And Setters (11)
|
|
102
|
+
// #region Public Methods (1)
|
|
103
|
+
removeVisualization() {
|
|
104
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_parentNode, "f").removeChild(__classPrivateFieldGet(this, _AbstractSnapRestriction_visualizationNode, "f"));
|
|
105
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_parentNode, "f").updateVersion(false, false);
|
|
106
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_viewport, "f").updateNode(__classPrivateFieldGet(this, _AbstractSnapRestriction_parentNode, "f"));
|
|
107
|
+
}
|
|
108
|
+
// #endregion Protected Abstract Methods (1)
|
|
109
|
+
// #region Private Methods (1)
|
|
110
|
+
createGridHelperObject() {
|
|
111
|
+
this._object3D = new THREE.Object3D();
|
|
112
|
+
this._object3D.visible = false;
|
|
113
|
+
const node = new viewer_shared_node_tree_1.TreeNode('ThreeJsDataNode');
|
|
114
|
+
const data = new viewer_rendering_engine_rendering_engine_threejs_1.ThreejsData(this._object3D);
|
|
115
|
+
node.addData(data);
|
|
116
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_visualizationNode, "f").addChild(node);
|
|
117
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_visualizationNode, "f").updateVersion();
|
|
118
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_parentNode, "f").addChild(__classPrivateFieldGet(this, _AbstractSnapRestriction_visualizationNode, "f"));
|
|
119
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_parentNode, "f").updateVersion(false, false);
|
|
120
|
+
__classPrivateFieldGet(this, _AbstractSnapRestriction_viewport, "f").updateNode(__classPrivateFieldGet(this, _AbstractSnapRestriction_parentNode, "f"));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.AbstractSnapRestriction = AbstractSnapRestriction;
|
|
124
|
+
_AbstractSnapRestriction_id = new WeakMap(), _AbstractSnapRestriction_parentNode = new WeakMap(), _AbstractSnapRestriction_viewport = new WeakMap(), _AbstractSnapRestriction_visualizationNode = new WeakMap(), _AbstractSnapRestriction_showVisualization = new WeakMap();
|
|
125
|
+
//# sourceMappingURL=AbstractSnapRestriction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractSnapRestriction.js","sourceRoot":"","sources":["../../../src/implementation/restrictions/AbstractSnapRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAG/B,iFAA0E;AAG1E,mIAA2F;AAG3F,MAAsB,uBAAuB;IAgBzC,6BAA6B;IAE7B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,UAAqB,EAAE,EAAU;QAnBrE,0BAA0B;QAE1B,8CAAqB;QACrB,sDAAgC;QAChC,oDAAiC;QACjC,qDAAwC,IAAI,kCAAQ,CAAC,8BAA8B,CAAC,EAAC;QAErF,qDAA8B,KAAK,EAAC;QAE1B,YAAO,GAAY,KAAK,CAAC;QACzB,aAAQ,GAAY,IAAI,CAAC;QACzB,qBAAgB,GAAY,IAAI,CAAC;QAEjC,cAAS,GAAW,CAAC,CAAC;QAO5B,uBAAA,IAAI,uCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,qCAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,+BAAO,EAAE,MAAA,CAAC;QACd,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAClC,CAAC;IAED,8BAA8B;IAE9B,0CAA0C;IAE1C,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,KAAc;QAC7B,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK;YAAE,OAAO;QAE5C,IAAI,CAAC,QAAQ,GAAG,KAA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GAAG,IAAI,kCAAQ,CAAC,iBAAiB,CAAC,CAAC;QAE7C,MAAM,IAAI,GAAG,IAAI,8DAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEnB,uBAAA,IAAI,kDAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,uBAAA,IAAI,kDAAmB,CAAC,aAAa,EAAE,CAAC;QACxC,uBAAA,IAAI,2CAAY,CAAC,QAAQ,CAAC,uBAAA,IAAI,kDAAmB,CAAC,CAAC;QACnD,uBAAA,IAAI,2CAAY,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7C,uBAAA,IAAI,yCAAU,CAAC,UAAU,CAAC,uBAAA,IAAI,2CAAY,CAAC,CAAC;IAChD,CAAC;CAGJ;AA3HD,0DA2HC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDragAnchor } from '../../interfaces/IDragAnchor';
|
|
2
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
3
|
+
export declare const calculateDragMatrix: (snapPoint: vec3, snapRotation: {
|
|
4
|
+
axis: vec3;
|
|
5
|
+
angle: number;
|
|
6
|
+
}, dragOrigin: vec3, dragAnchors: IDragAnchor[] | undefined, closestPoint: vec3) => {
|
|
7
|
+
matrix: mat4;
|
|
8
|
+
dragAnchor?: IDragAnchor;
|
|
9
|
+
point: vec3;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=RestrictionsHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestrictionsHelper.d.ts","sourceRoot":"","sources":["../../../src/implementation/restrictions/RestrictionsHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEvC,eAAO,MAAM,mBAAmB,cAEb,IAAI,gBACD;IACV,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAA;CAChB,cACW,IAAI,wDAEF,IAAI,KACnB;IACC,MAAM,EAAE,IAAI,CAAC;IACb,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,IAAI,CAAA;CAqBd,CAAC"}
|