@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.16.8 → 3.16.10

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.
Files changed (95) hide show
  1. package/dist/api/implementation/AbstractRestrictionApi.d.ts +12 -12
  2. package/dist/api/implementation/AbstractRestrictionApi.js +46 -46
  3. package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -1
  4. package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +12 -12
  5. package/dist/api/implementation/AbstractSnapRestrictionApi.js +46 -46
  6. package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -1
  7. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +6 -6
  8. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js +23 -23
  9. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -1
  10. package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +14 -14
  11. package/dist/api/implementation/geometry/GeometryRestrictionApi.js +53 -53
  12. package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -1
  13. package/dist/api/implementation/line/LineRestrictionApi.d.ts +10 -10
  14. package/dist/api/implementation/line/LineRestrictionApi.js +39 -39
  15. package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -1
  16. package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +19 -19
  17. package/dist/api/implementation/plane/PlaneRestrictionApi.js +66 -66
  18. package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -1
  19. package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +9 -9
  20. package/dist/api/implementation/plane/snap/AngularRestrictionApi.js +39 -39
  21. package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -1
  22. package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +6 -6
  23. package/dist/api/implementation/plane/snap/AxisRestrictionApi.js +23 -23
  24. package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -1
  25. package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +9 -9
  26. package/dist/api/implementation/plane/snap/GridRestrictionApi.js +39 -39
  27. package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -1
  28. package/dist/api/implementation/point/PointRestrictionApi.d.ts +9 -9
  29. package/dist/api/implementation/point/PointRestrictionApi.js +36 -36
  30. package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -1
  31. package/dist/api/interfaces/IRestrictionApi.d.ts +10 -10
  32. package/dist/api/interfaces/IRestrictionApi.js +2 -2
  33. package/dist/api/interfaces/ISnapRestrictionApi.d.ts +12 -12
  34. package/dist/api/interfaces/ISnapRestrictionApi.js +2 -2
  35. package/dist/implementation/EventManager.d.ts +25 -25
  36. package/dist/implementation/EventManager.d.ts.map +1 -1
  37. package/dist/implementation/EventManager.js +62 -62
  38. package/dist/implementation/EventManager.js.map +1 -1
  39. package/dist/implementation/GeometryMathManager.d.ts +87 -87
  40. package/dist/implementation/GeometryMathManager.js +260 -260
  41. package/dist/implementation/GeometryMathManager.js.map +1 -1
  42. package/dist/implementation/RestrictionManager.d.ts +28 -28
  43. package/dist/implementation/RestrictionManager.js +323 -323
  44. package/dist/implementation/RestrictionManager.js.map +1 -1
  45. package/dist/implementation/restrictions/AbstractRestriction.d.ts +42 -42
  46. package/dist/implementation/restrictions/AbstractRestriction.js +164 -154
  47. package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -1
  48. package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +35 -35
  49. package/dist/implementation/restrictions/AbstractSnapRestriction.js +150 -140
  50. package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -1
  51. package/dist/implementation/restrictions/RestrictionsHelper.d.ts +10 -10
  52. package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -1
  53. package/dist/implementation/restrictions/RestrictionsHelper.js +50 -50
  54. package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -1
  55. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +17 -17
  56. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +62 -62
  57. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -1
  58. package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +92 -92
  59. package/dist/implementation/restrictions/geometry/GeometryRestriction.js +410 -400
  60. package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -1
  61. package/dist/implementation/restrictions/line/LineRestriction.d.ts +58 -58
  62. package/dist/implementation/restrictions/line/LineRestriction.js +291 -281
  63. package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -1
  64. package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +65 -65
  65. package/dist/implementation/restrictions/plane/PlaneRestriction.js +306 -306
  66. package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -1
  67. package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +39 -39
  68. package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -1
  69. package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +346 -346
  70. package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -1
  71. package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +27 -27
  72. package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -1
  73. package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +239 -229
  74. package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -1
  75. package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +39 -39
  76. package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -1
  77. package/dist/implementation/restrictions/plane/snap/GridRestriction.js +318 -308
  78. package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -1
  79. package/dist/implementation/restrictions/point/PointRestriction.d.ts +45 -45
  80. package/dist/implementation/restrictions/point/PointRestriction.js +166 -156
  81. package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -1
  82. package/dist/index.d.ts +29 -29
  83. package/dist/index.js +37 -37
  84. package/dist/interfaces/IDragAnchor.d.ts +8 -8
  85. package/dist/interfaces/IDragAnchor.js +2 -2
  86. package/dist/interfaces/IRestriction.d.ts +117 -117
  87. package/dist/interfaces/IRestriction.d.ts.map +1 -1
  88. package/dist/interfaces/IRestriction.js +23 -23
  89. package/dist/interfaces/IRestriction.js.map +1 -1
  90. package/dist/interfaces/IRestrictionManager.d.ts +13 -13
  91. package/dist/interfaces/IRestrictionManager.js +2 -2
  92. package/dist/interfaces/ISnapRestriction.d.ts +81 -81
  93. package/dist/interfaces/ISnapRestriction.d.ts.map +1 -1
  94. package/dist/interfaces/ISnapRestriction.js +3 -3
  95. package/package.json +10 -10
@@ -1,324 +1,324 @@
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_keysToggled, _RestrictionManager_restrictionManagerNode, _RestrictionManager_showRestrictionVisualization;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.RestrictionManager = void 0;
16
- const viewer_1 = require("@shapediver/viewer");
17
- const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
18
- const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
19
- const IRestriction_1 = require("../interfaces/IRestriction");
20
- const EventManager_1 = require("./EventManager");
21
- const GeometryMathManager_1 = require("./GeometryMathManager");
22
- const CameraPlaneRestriction_1 = require("./restrictions/camera_plane/CameraPlaneRestriction");
23
- const GeometryRestriction_1 = require("./restrictions/geometry/GeometryRestriction");
24
- const LineRestriction_1 = require("./restrictions/line/LineRestriction");
25
- const PlaneRestriction_1 = require("./restrictions/plane/PlaneRestriction");
26
- const PointRestriction_1 = require("./restrictions/point/PointRestriction");
27
- const RestrictionsHelper_1 = require("./restrictions/RestrictionsHelper");
28
- class RestrictionManager {
29
- // #endregion Properties (11)
30
- // #region Constructors (1)
31
- constructor(viewport, parentNode = viewer_1.sceneTree.root, restrictions, settings) {
32
- // #region Properties (11)
33
- _RestrictionManager_eventManager.set(this, void 0);
34
- _RestrictionManager_geometryMathManager.set(this, void 0);
35
- _RestrictionManager_parentNode.set(this, void 0);
36
- _RestrictionManager_restrictions.set(this, {});
37
- _RestrictionManager_settings.set(this, {
38
- distanceLabels: true,
39
- distanceMultiplicationFactor: 2,
40
- lines: {
41
- color: "#0d44f0",
42
- },
43
- pointLabels: false,
44
- pointerPosition: true,
45
- points: {
46
- size_0: 15,
47
- size_1: 20,
48
- size_2: 15,
49
- size_3: 20,
50
- size_4: 15,
51
- size_5: 20,
52
- size_6: 10,
53
- color_0: "#0d44f0",
54
- color_1: "#197aeb",
55
- color_2: "#9e27d8",
56
- color_3: "#bc47fd",
57
- color_4: "#00ff78",
58
- color_5: "#00ff78",
59
- color_6: "#888888",
60
- },
61
- });
62
- _RestrictionManager_uuidGenerator.set(this, viewer_shared_services_1.UuidGenerator.instance);
63
- _RestrictionManager_viewport.set(this, void 0);
64
- _RestrictionManager_closed.set(this, false);
65
- _RestrictionManager_keysPressed.set(this, {});
66
- _RestrictionManager_keysToggled.set(this, {});
67
- _RestrictionManager_restrictionManagerNode.set(this, void 0);
68
- _RestrictionManager_showRestrictionVisualization.set(this, false);
69
- __classPrivateFieldSet(this, _RestrictionManager_viewport, viewport, "f");
70
- __classPrivateFieldSet(this, _RestrictionManager_parentNode, parentNode, "f");
71
- __classPrivateFieldSet(this, _RestrictionManager_restrictionManagerNode, new viewer_shared_node_tree_1.TreeNode("RestrictionManager"), "f");
72
- __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").addChild(__classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"));
73
- __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").updateVersion(false, false);
74
- if (settings)
75
- __classPrivateFieldSet(this, _RestrictionManager_settings, settings, "f");
76
- __classPrivateFieldSet(this, _RestrictionManager_geometryMathManager, new GeometryMathManager_1.GeometryMathManager(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_settings, "f")), "f");
77
- __classPrivateFieldSet(this, _RestrictionManager_eventManager, new EventManager_1.EventManager(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), {
78
- onDown: this.onDown.bind(this),
79
- onUp: this.onUp.bind(this),
80
- onOut: this.onOut.bind(this),
81
- onMove: this.onMove.bind(this),
82
- onKeyDown: this.onKeyDown.bind(this),
83
- onKeyUp: this.onKeyUp.bind(this),
84
- }), "f");
85
- if (restrictions) {
86
- for (const r of restrictions) {
87
- this.addRestriction(r);
88
- }
89
- }
90
- }
91
- // #endregion Constructors (1)
92
- // #region Public Getters And Setters (4)
93
- get closed() {
94
- return __classPrivateFieldGet(this, _RestrictionManager_closed, "f");
95
- }
96
- get restrictions() {
97
- return __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f");
98
- }
99
- get showRestrictionVisualization() {
100
- return __classPrivateFieldGet(this, _RestrictionManager_showRestrictionVisualization, "f");
101
- }
102
- set showRestrictionVisualization(value) {
103
- __classPrivateFieldSet(this, _RestrictionManager_showRestrictionVisualization, value, "f");
104
- for (const restriction of Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f"))) {
105
- restriction.showVisualization = value;
106
- for (const snapRestriction of Object.values(restriction.snapRestrictions)) {
107
- snapRestriction.showVisualization = value;
108
- }
109
- }
110
- }
111
- // #endregion Public Getters And Setters (4)
112
- // #region Public Methods (6)
113
- addRestriction(properties) {
114
- const token = properties.id || __classPrivateFieldGet(this, _RestrictionManager_uuidGenerator, "f").create();
115
- let restriction;
116
- if (properties.type === IRestriction_1.RESTRICTION_TYPE.PLANE) {
117
- 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);
118
- }
119
- else if (properties.type === IRestriction_1.RESTRICTION_TYPE.GEOMETRY) {
120
- 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);
121
- }
122
- else if (properties.type === IRestriction_1.RESTRICTION_TYPE.CAMERA_PLANE) {
123
- 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);
124
- }
125
- else if (properties.type === IRestriction_1.RESTRICTION_TYPE.POINT) {
126
- 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);
127
- }
128
- else if (properties.type === IRestriction_1.RESTRICTION_TYPE.LINE) {
129
- 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);
130
- }
131
- if (restriction) {
132
- __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token] = restriction;
133
- return token;
134
- }
135
- return;
136
- }
137
- close() {
138
- __classPrivateFieldSet(this, _RestrictionManager_closed, true, "f");
139
- __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").removeChild(__classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"));
140
- __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").updateVersion(false, false);
141
- __classPrivateFieldGet(this, _RestrictionManager_eventManager, "f").close();
142
- __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f").close();
143
- Object.keys(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")).forEach((key) => this.removeRestriction(key));
144
- }
145
- getPressedKeys() {
146
- return Object.keys(__classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")).filter((key) => __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[key] === true);
147
- }
148
- getToggleKeys() {
149
- return Object.keys(__classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")).filter((key) => __classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[key] === true);
150
- }
151
- getRestriction(token) {
152
- return __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token];
153
- }
154
- rayTrace(ray, metaData) {
155
- const restrictionResults = [];
156
- metaData.pressedKeys = this.getPressedKeys();
157
- metaData.toggledKeys = this.getToggleKeys();
158
- for (const restrictionId in __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")) {
159
- const restriction = __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[restrictionId];
160
- const hit = restriction.rayTrace(ray, metaData);
161
- if (!hit)
162
- continue;
163
- const distanceSquared = hit.distanceOriginToClosestIntersectionPointSquared;
164
- if (distanceSquared >= Infinity)
165
- continue;
166
- restrictionResults.push(hit);
167
- }
168
- if (restrictionResults.length === 0)
169
- return;
170
- // first, sort the results by distance
171
- restrictionResults.sort((a, b) => a.distanceOriginToClosestIntersectionPointSquared -
172
- b.distanceOriginToClosestIntersectionPointSquared);
173
- /**
174
- * We iterate over the results and check if the restriction with the higher priority has a radius
175
- * and if the hit of the restriction with the higher priority is within the radius of the restriction with the lower priority.
176
- *
177
- * If this is the case, we set the restriction with the higher priority as the hit restriction.
178
- */
179
- let restrictionResult = restrictionResults[0];
180
- for (const result of restrictionResults) {
181
- // if the priority of the restriction is higher than the priority of the restriction that is currently hit
182
- if (result.restriction.priority >
183
- restrictionResult.restriction.priority) {
184
- // check if the closest point of the restriction with the higher priority is within the radius of the restriction with the lower priority
185
- const hitHigherPriority = result.closestIntersectionPoint;
186
- if (restrictionResult.restriction instanceof PointRestriction_1.PointRestriction ||
187
- restrictionResult.restriction instanceof LineRestriction_1.LineRestriction) {
188
- if (restrictionResult.restriction.isWithinRadius(hitHigherPriority)) {
189
- restrictionResult = result;
190
- }
191
- }
192
- // if there is a result for a geometry restriction,
193
- // we prioritize this result over the other restrictions,
194
- // as this always means it's within the radius
195
- if (result.restriction instanceof GeometryRestriction_1.GeometryRestriction) {
196
- restrictionResult = result;
197
- }
198
- }
199
- else if (result.restriction.priority ===
200
- restrictionResult.restriction.priority) {
201
- // if the priority is the same, we check the distance id the type is a point or line restriction
202
- if (result.restriction instanceof PointRestriction_1.PointRestriction ||
203
- result.restriction instanceof LineRestriction_1.LineRestriction) {
204
- if (result.distanceClosestPointToTargetPointSquared <
205
- restrictionResult.distanceClosestPointToTargetPointSquared) {
206
- restrictionResult = result;
207
- }
208
- }
209
- }
210
- }
211
- // if the restriction is hideable, we check if the closest restriction is actually hidden
212
- if (restrictionResult.restriction.hideable) {
213
- // create a filter to check if the node is hidden or is not fully opaque
214
- const filter = (node, geometryData) => {
215
- if (node.visible === false)
216
- return false;
217
- if (geometryData &&
218
- geometryData.material &&
219
- geometryData.material.opacity < 1.0)
220
- return false;
221
- return true;
222
- };
223
- // check if the closest restriction is actually hidden
224
- const sceneRayTrace = __classPrivateFieldGet(this, _RestrictionManager_viewport, "f").raytraceScene(ray.origin, ray.direction, [filter]);
225
- if (sceneRayTrace.length > 0) {
226
- const squaredDistanceSceneRayTrace = sceneRayTrace[0].distance * sceneRayTrace[0].distance;
227
- if (squaredDistanceSceneRayTrace <
228
- restrictionResult.distanceOriginToClosestIntersectionPointSquared) {
229
- // the second check is to make sure that the geometry data of the geometry restriction and the scene ray trace is available
230
- if (restrictionResult.restriction.type !==
231
- IRestriction_1.RESTRICTION_TYPE.GEOMETRY ||
232
- (restrictionResult.restriction.type ===
233
- IRestriction_1.RESTRICTION_TYPE.GEOMETRY &&
234
- (!restrictionResult.restrictionIntersectionData ||
235
- !sceneRayTrace[0].data)))
236
- return;
237
- const geometryRestrictionIntersectionData = restrictionResult.restrictionIntersectionData;
238
- // it is NOT the same geometry
239
- if (!(geometryRestrictionIntersectionData.geometryData
240
- .id === sceneRayTrace[0].data.id &&
241
- geometryRestrictionIntersectionData.geometryData
242
- .version === sceneRayTrace[0].data.version))
243
- return;
244
- }
245
- }
246
- }
247
- // deactivate the visualization of all restrictions that are not hit
248
- for (const restriction of Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f"))) {
249
- if (restrictionResult &&
250
- restriction !== restrictionResult.restriction) {
251
- for (const snapRestriction of Object.values(restriction.snapRestrictions)) {
252
- snapRestriction.active = false;
253
- }
254
- }
255
- }
256
- if ((0, IRestriction_1.isDraggingRestriction)(metaData)) {
257
- const { matrix, dragAnchor } = (0, RestrictionsHelper_1.calculateDragMatrix)(restrictionResult.targetPoint, restrictionResult.restriction.rotation, metaData.dragOrigin, metaData.dragAnchors, restrictionResult.closestIntersectionPoint);
258
- return {
259
- restriction: restrictionResult.restriction,
260
- restrictionResult: restrictionResult,
261
- point: restrictionResult.targetPoint,
262
- closestPointOnRay: restrictionResult.closestIntersectionPoint,
263
- distanceSquared: restrictionResult.distanceOriginToClosestIntersectionPointSquared,
264
- dragAnchor: dragAnchor,
265
- transformation: matrix,
266
- };
267
- }
268
- else {
269
- return {
270
- restriction: restrictionResult.restriction,
271
- restrictionResult: restrictionResult,
272
- point: restrictionResult.targetPoint,
273
- closestPointOnRay: restrictionResult.closestIntersectionPoint,
274
- distanceSquared: restrictionResult.distanceOriginToClosestIntersectionPointSquared,
275
- };
276
- }
277
- }
278
- removeRestriction(token) {
279
- if (__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token]) {
280
- Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token].snapRestrictions).forEach((r) => r.removeVisualization());
281
- __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token].removeVisualization();
282
- delete __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token];
283
- return true;
284
- }
285
- return false;
286
- }
287
- // #endregion Public Methods (6)
288
- // #region Private Methods (6)
289
- onDown(event, ray) {
290
- if (this.closed)
291
- return;
292
- }
293
- onKeyDown(event, pointerInCanvas) {
294
- if (this.closed)
295
- return;
296
- if (!pointerInCanvas)
297
- return;
298
- __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[event.key] = true;
299
- if (__classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key] === undefined)
300
- __classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key] = true;
301
- else
302
- __classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key] = !__classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key];
303
- }
304
- onKeyUp(event, pointerInCanvas) {
305
- if (this.closed)
306
- return;
307
- __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[event.key] = false;
308
- }
309
- onMove(event, ray) {
310
- if (this.closed)
311
- return;
312
- }
313
- onOut() {
314
- if (this.closed)
315
- return;
316
- }
317
- onUp() {
318
- if (this.closed)
319
- return;
320
- }
321
- }
322
- exports.RestrictionManager = RestrictionManager;
323
- _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_keysToggled = new WeakMap(), _RestrictionManager_restrictionManagerNode = new WeakMap(), _RestrictionManager_showRestrictionVisualization = new WeakMap();
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_keysToggled, _RestrictionManager_restrictionManagerNode, _RestrictionManager_showRestrictionVisualization;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RestrictionManager = void 0;
16
+ const viewer_1 = require("@shapediver/viewer");
17
+ const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
18
+ const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
19
+ const IRestriction_1 = require("../interfaces/IRestriction");
20
+ const EventManager_1 = require("./EventManager");
21
+ const GeometryMathManager_1 = require("./GeometryMathManager");
22
+ const CameraPlaneRestriction_1 = require("./restrictions/camera_plane/CameraPlaneRestriction");
23
+ const GeometryRestriction_1 = require("./restrictions/geometry/GeometryRestriction");
24
+ const LineRestriction_1 = require("./restrictions/line/LineRestriction");
25
+ const PlaneRestriction_1 = require("./restrictions/plane/PlaneRestriction");
26
+ const PointRestriction_1 = require("./restrictions/point/PointRestriction");
27
+ const RestrictionsHelper_1 = require("./restrictions/RestrictionsHelper");
28
+ class RestrictionManager {
29
+ // #endregion Properties (11)
30
+ // #region Constructors (1)
31
+ constructor(viewport, parentNode = viewer_1.sceneTree.root, restrictions, settings) {
32
+ // #region Properties (11)
33
+ _RestrictionManager_eventManager.set(this, void 0);
34
+ _RestrictionManager_geometryMathManager.set(this, void 0);
35
+ _RestrictionManager_parentNode.set(this, void 0);
36
+ _RestrictionManager_restrictions.set(this, {});
37
+ _RestrictionManager_settings.set(this, {
38
+ distanceLabels: true,
39
+ distanceMultiplicationFactor: 2,
40
+ lines: {
41
+ color: "#0d44f0",
42
+ },
43
+ pointLabels: false,
44
+ pointerPosition: true,
45
+ points: {
46
+ size_0: 15,
47
+ size_1: 20,
48
+ size_2: 15,
49
+ size_3: 20,
50
+ size_4: 15,
51
+ size_5: 20,
52
+ size_6: 10,
53
+ color_0: "#0d44f0",
54
+ color_1: "#197aeb",
55
+ color_2: "#9e27d8",
56
+ color_3: "#bc47fd",
57
+ color_4: "#00ff78",
58
+ color_5: "#00ff78",
59
+ color_6: "#888888",
60
+ },
61
+ });
62
+ _RestrictionManager_uuidGenerator.set(this, viewer_shared_services_1.UuidGenerator.instance);
63
+ _RestrictionManager_viewport.set(this, void 0);
64
+ _RestrictionManager_closed.set(this, false);
65
+ _RestrictionManager_keysPressed.set(this, {});
66
+ _RestrictionManager_keysToggled.set(this, {});
67
+ _RestrictionManager_restrictionManagerNode.set(this, void 0);
68
+ _RestrictionManager_showRestrictionVisualization.set(this, false);
69
+ __classPrivateFieldSet(this, _RestrictionManager_viewport, viewport, "f");
70
+ __classPrivateFieldSet(this, _RestrictionManager_parentNode, parentNode, "f");
71
+ __classPrivateFieldSet(this, _RestrictionManager_restrictionManagerNode, new viewer_shared_node_tree_1.TreeNode("RestrictionManager"), "f");
72
+ __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").addChild(__classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"));
73
+ __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").updateVersion(false, false);
74
+ if (settings)
75
+ __classPrivateFieldSet(this, _RestrictionManager_settings, settings, "f");
76
+ __classPrivateFieldSet(this, _RestrictionManager_geometryMathManager, new GeometryMathManager_1.GeometryMathManager(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), __classPrivateFieldGet(this, _RestrictionManager_settings, "f")), "f");
77
+ __classPrivateFieldSet(this, _RestrictionManager_eventManager, new EventManager_1.EventManager(__classPrivateFieldGet(this, _RestrictionManager_viewport, "f"), {
78
+ onDown: this.onDown.bind(this),
79
+ onUp: this.onUp.bind(this),
80
+ onOut: this.onOut.bind(this),
81
+ onMove: this.onMove.bind(this),
82
+ onKeyDown: this.onKeyDown.bind(this),
83
+ onKeyUp: this.onKeyUp.bind(this),
84
+ }), "f");
85
+ if (restrictions) {
86
+ for (const r of restrictions) {
87
+ this.addRestriction(r);
88
+ }
89
+ }
90
+ }
91
+ // #endregion Constructors (1)
92
+ // #region Public Getters And Setters (4)
93
+ get closed() {
94
+ return __classPrivateFieldGet(this, _RestrictionManager_closed, "f");
95
+ }
96
+ get restrictions() {
97
+ return __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f");
98
+ }
99
+ get showRestrictionVisualization() {
100
+ return __classPrivateFieldGet(this, _RestrictionManager_showRestrictionVisualization, "f");
101
+ }
102
+ set showRestrictionVisualization(value) {
103
+ __classPrivateFieldSet(this, _RestrictionManager_showRestrictionVisualization, value, "f");
104
+ for (const restriction of Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f"))) {
105
+ restriction.showVisualization = value;
106
+ for (const snapRestriction of Object.values(restriction.snapRestrictions)) {
107
+ snapRestriction.showVisualization = value;
108
+ }
109
+ }
110
+ }
111
+ // #endregion Public Getters And Setters (4)
112
+ // #region Public Methods (6)
113
+ addRestriction(properties) {
114
+ const token = properties.id || __classPrivateFieldGet(this, _RestrictionManager_uuidGenerator, "f").create();
115
+ let restriction;
116
+ if (properties.type === IRestriction_1.RESTRICTION_TYPE.PLANE) {
117
+ 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);
118
+ }
119
+ else if (properties.type === IRestriction_1.RESTRICTION_TYPE.GEOMETRY) {
120
+ 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);
121
+ }
122
+ else if (properties.type === IRestriction_1.RESTRICTION_TYPE.CAMERA_PLANE) {
123
+ 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);
124
+ }
125
+ else if (properties.type === IRestriction_1.RESTRICTION_TYPE.POINT) {
126
+ 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);
127
+ }
128
+ else if (properties.type === IRestriction_1.RESTRICTION_TYPE.LINE) {
129
+ 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);
130
+ }
131
+ if (restriction) {
132
+ __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token] = restriction;
133
+ return token;
134
+ }
135
+ return;
136
+ }
137
+ close() {
138
+ __classPrivateFieldSet(this, _RestrictionManager_closed, true, "f");
139
+ __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").removeChild(__classPrivateFieldGet(this, _RestrictionManager_restrictionManagerNode, "f"));
140
+ __classPrivateFieldGet(this, _RestrictionManager_parentNode, "f").updateVersion(false, false);
141
+ __classPrivateFieldGet(this, _RestrictionManager_eventManager, "f").close();
142
+ __classPrivateFieldGet(this, _RestrictionManager_geometryMathManager, "f").close();
143
+ Object.keys(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")).forEach((key) => this.removeRestriction(key));
144
+ }
145
+ getPressedKeys() {
146
+ return Object.keys(__classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")).filter((key) => __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[key] === true);
147
+ }
148
+ getToggleKeys() {
149
+ return Object.keys(__classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")).filter((key) => __classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[key] === true);
150
+ }
151
+ getRestriction(token) {
152
+ return __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token];
153
+ }
154
+ rayTrace(ray, metaData) {
155
+ const restrictionResults = [];
156
+ metaData.pressedKeys = this.getPressedKeys();
157
+ metaData.toggledKeys = this.getToggleKeys();
158
+ for (const restrictionId in __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")) {
159
+ const restriction = __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[restrictionId];
160
+ const hit = restriction.rayTrace(ray, metaData);
161
+ if (!hit)
162
+ continue;
163
+ const distanceSquared = hit.distanceOriginToClosestIntersectionPointSquared;
164
+ if (distanceSquared >= Infinity)
165
+ continue;
166
+ restrictionResults.push(hit);
167
+ }
168
+ if (restrictionResults.length === 0)
169
+ return;
170
+ // first, sort the results by distance
171
+ restrictionResults.sort((a, b) => a.distanceOriginToClosestIntersectionPointSquared -
172
+ b.distanceOriginToClosestIntersectionPointSquared);
173
+ /**
174
+ * We iterate over the results and check if the restriction with the higher priority has a radius
175
+ * and if the hit of the restriction with the higher priority is within the radius of the restriction with the lower priority.
176
+ *
177
+ * If this is the case, we set the restriction with the higher priority as the hit restriction.
178
+ */
179
+ let restrictionResult = restrictionResults[0];
180
+ for (const result of restrictionResults) {
181
+ // if the priority of the restriction is higher than the priority of the restriction that is currently hit
182
+ if (result.restriction.priority >
183
+ restrictionResult.restriction.priority) {
184
+ // check if the closest point of the restriction with the higher priority is within the radius of the restriction with the lower priority
185
+ const hitHigherPriority = result.closestIntersectionPoint;
186
+ if (restrictionResult.restriction instanceof PointRestriction_1.PointRestriction ||
187
+ restrictionResult.restriction instanceof LineRestriction_1.LineRestriction) {
188
+ if (restrictionResult.restriction.isWithinRadius(hitHigherPriority)) {
189
+ restrictionResult = result;
190
+ }
191
+ }
192
+ // if there is a result for a geometry restriction,
193
+ // we prioritize this result over the other restrictions,
194
+ // as this always means it's within the radius
195
+ if (result.restriction instanceof GeometryRestriction_1.GeometryRestriction) {
196
+ restrictionResult = result;
197
+ }
198
+ }
199
+ else if (result.restriction.priority ===
200
+ restrictionResult.restriction.priority) {
201
+ // if the priority is the same, we check the distance id the type is a point or line restriction
202
+ if (result.restriction instanceof PointRestriction_1.PointRestriction ||
203
+ result.restriction instanceof LineRestriction_1.LineRestriction) {
204
+ if (result.distanceClosestPointToTargetPointSquared <
205
+ restrictionResult.distanceClosestPointToTargetPointSquared) {
206
+ restrictionResult = result;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ // if the restriction is hideable, we check if the closest restriction is actually hidden
212
+ if (restrictionResult.restriction.hideable) {
213
+ // create a filter to check if the node is hidden or is not fully opaque
214
+ const filter = (node, geometryData) => {
215
+ if (node.visible === false)
216
+ return false;
217
+ if (geometryData &&
218
+ geometryData.material &&
219
+ geometryData.material.opacity < 1.0)
220
+ return false;
221
+ return true;
222
+ };
223
+ // check if the closest restriction is actually hidden
224
+ const sceneRayTrace = __classPrivateFieldGet(this, _RestrictionManager_viewport, "f").raytraceScene(ray.origin, ray.direction, [filter]);
225
+ if (sceneRayTrace.length > 0) {
226
+ const squaredDistanceSceneRayTrace = sceneRayTrace[0].distance * sceneRayTrace[0].distance;
227
+ if (squaredDistanceSceneRayTrace <
228
+ restrictionResult.distanceOriginToClosestIntersectionPointSquared) {
229
+ // the second check is to make sure that the geometry data of the geometry restriction and the scene ray trace is available
230
+ if (restrictionResult.restriction.type !==
231
+ IRestriction_1.RESTRICTION_TYPE.GEOMETRY ||
232
+ (restrictionResult.restriction.type ===
233
+ IRestriction_1.RESTRICTION_TYPE.GEOMETRY &&
234
+ (!restrictionResult.restrictionIntersectionData ||
235
+ !sceneRayTrace[0].data)))
236
+ return;
237
+ const geometryRestrictionIntersectionData = restrictionResult.restrictionIntersectionData;
238
+ // it is NOT the same geometry
239
+ if (!(geometryRestrictionIntersectionData.geometryData
240
+ .id === sceneRayTrace[0].data.id &&
241
+ geometryRestrictionIntersectionData.geometryData
242
+ .version === sceneRayTrace[0].data.version))
243
+ return;
244
+ }
245
+ }
246
+ }
247
+ // deactivate the visualization of all restrictions that are not hit
248
+ for (const restriction of Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f"))) {
249
+ if (restrictionResult &&
250
+ restriction !== restrictionResult.restriction) {
251
+ for (const snapRestriction of Object.values(restriction.snapRestrictions)) {
252
+ snapRestriction.active = false;
253
+ }
254
+ }
255
+ }
256
+ if ((0, IRestriction_1.isDraggingRestriction)(metaData)) {
257
+ const { matrix, dragAnchor } = (0, RestrictionsHelper_1.calculateDragMatrix)(restrictionResult.targetPoint, restrictionResult.restriction.rotation, metaData.dragOrigin, metaData.dragAnchors, restrictionResult.closestIntersectionPoint);
258
+ return {
259
+ restriction: restrictionResult.restriction,
260
+ restrictionResult: restrictionResult,
261
+ point: restrictionResult.targetPoint,
262
+ closestPointOnRay: restrictionResult.closestIntersectionPoint,
263
+ distanceSquared: restrictionResult.distanceOriginToClosestIntersectionPointSquared,
264
+ dragAnchor: dragAnchor,
265
+ transformation: matrix,
266
+ };
267
+ }
268
+ else {
269
+ return {
270
+ restriction: restrictionResult.restriction,
271
+ restrictionResult: restrictionResult,
272
+ point: restrictionResult.targetPoint,
273
+ closestPointOnRay: restrictionResult.closestIntersectionPoint,
274
+ distanceSquared: restrictionResult.distanceOriginToClosestIntersectionPointSquared,
275
+ };
276
+ }
277
+ }
278
+ removeRestriction(token) {
279
+ if (__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token]) {
280
+ Object.values(__classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token].snapRestrictions).forEach((r) => r.removeVisualization());
281
+ __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token].removeVisualization();
282
+ delete __classPrivateFieldGet(this, _RestrictionManager_restrictions, "f")[token];
283
+ return true;
284
+ }
285
+ return false;
286
+ }
287
+ // #endregion Public Methods (6)
288
+ // #region Private Methods (6)
289
+ onDown(event, ray) {
290
+ if (this.closed)
291
+ return;
292
+ }
293
+ onKeyDown(event, pointerInCanvas) {
294
+ if (this.closed)
295
+ return;
296
+ if (!pointerInCanvas)
297
+ return;
298
+ __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[event.key] = true;
299
+ if (__classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key] === undefined)
300
+ __classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key] = true;
301
+ else
302
+ __classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key] = !__classPrivateFieldGet(this, _RestrictionManager_keysToggled, "f")[event.key];
303
+ }
304
+ onKeyUp(event, pointerInCanvas) {
305
+ if (this.closed)
306
+ return;
307
+ __classPrivateFieldGet(this, _RestrictionManager_keysPressed, "f")[event.key] = false;
308
+ }
309
+ onMove(event, ray) {
310
+ if (this.closed)
311
+ return;
312
+ }
313
+ onOut() {
314
+ if (this.closed)
315
+ return;
316
+ }
317
+ onUp() {
318
+ if (this.closed)
319
+ return;
320
+ }
321
+ }
322
+ exports.RestrictionManager = RestrictionManager;
323
+ _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_keysToggled = new WeakMap(), _RestrictionManager_restrictionManagerNode = new WeakMap(), _RestrictionManager_showRestrictionVisualization = new WeakMap();
324
324
  //# sourceMappingURL=RestrictionManager.js.map