@shapediver/viewer.features.drawing-tools 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/implementation/DrawingToolsApi.d.ts.map +1 -1
- package/dist/api/implementation/DrawingToolsApi.js +0 -6
- package/dist/api/implementation/DrawingToolsApi.js.map +1 -1
- package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.d.ts +4 -2
- package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.js +17 -11
- package/dist/api/implementation/restrictions/plane/PlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/restrictions/plane/snap/AxisRestrictionApi.d.ts +7 -0
- package/dist/api/implementation/restrictions/plane/snap/AxisRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/restrictions/{axis → plane/snap}/AxisRestrictionApi.js +2 -2
- package/dist/api/implementation/restrictions/plane/snap/AxisRestrictionApi.js.map +1 -0
- package/dist/api/interfaces/IDrawingToolsApi.d.ts +1 -2
- package/dist/api/interfaces/IDrawingToolsApi.d.ts.map +1 -1
- package/dist/business/implementation/DrawingToolsManager.d.ts.map +1 -1
- package/dist/business/implementation/DrawingToolsManager.js +0 -1
- package/dist/business/implementation/DrawingToolsManager.js.map +1 -1
- package/dist/business/implementation/managers/TextVisualizationManager.d.ts.map +1 -1
- package/dist/business/implementation/managers/TextVisualizationManager.js +52 -28
- package/dist/business/implementation/managers/TextVisualizationManager.js.map +1 -1
- package/dist/business/implementation/managers/geometry/GeometryMathManager.d.ts +17 -8
- package/dist/business/implementation/managers/geometry/GeometryMathManager.d.ts.map +1 -1
- package/dist/business/implementation/managers/geometry/GeometryMathManager.js +31 -16
- package/dist/business/implementation/managers/geometry/GeometryMathManager.js.map +1 -1
- package/dist/business/implementation/managers/interaction/RestrictionManager.d.ts.map +1 -1
- package/dist/business/implementation/managers/interaction/RestrictionManager.js +0 -4
- package/dist/business/implementation/managers/interaction/RestrictionManager.js.map +1 -1
- package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.d.ts +8 -0
- package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.d.ts.map +1 -1
- package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.js +107 -43
- package/dist/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.js.map +1 -1
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.d.ts +3 -2
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -1
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.js +38 -29
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.js.map +1 -1
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction.d.ts +26 -0
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -0
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction.js +93 -0
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction.js.map +1 -0
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.d.ts +4 -2
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.d.ts.map +1 -1
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.js +18 -34
- package/dist/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.js.map +1 -1
- package/dist/business/interfaces/IDrawingToolsManager.d.ts +2 -3
- package/dist/business/interfaces/IDrawingToolsManager.d.ts.map +1 -1
- package/dist/business/interfaces/IDrawingToolsManager.js.map +1 -1
- package/dist/business/interfaces/IRestriction.d.ts +0 -1
- package/dist/business/interfaces/IRestriction.d.ts.map +1 -1
- package/dist/business/interfaces/IRestriction.js +0 -1
- package/dist/business/interfaces/IRestriction.js.map +1 -1
- package/dist/business/interfaces/ISnapRestriction.d.ts +7 -5
- package/dist/business/interfaces/ISnapRestriction.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/api/implementation/DrawingToolsApi.ts +1 -6
- package/src/api/implementation/restrictions/plane/PlaneRestrictionApi.ts +19 -12
- package/src/api/implementation/restrictions/{axis → plane/snap}/AxisRestrictionApi.ts +3 -3
- package/src/api/interfaces/IDrawingToolsApi.ts +1 -2
- package/src/business/implementation/DrawingToolsManager.ts +0 -1
- package/src/business/implementation/managers/TextVisualizationManager.ts +52 -28
- package/src/business/implementation/managers/geometry/GeometryMathManager.ts +36 -20
- package/src/business/implementation/managers/interaction/RestrictionManager.ts +0 -3
- package/src/business/implementation/managers/interaction/restrictions/plane/PlaneRestriction.ts +127 -47
- package/src/business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction.ts +38 -28
- package/src/business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction.ts +116 -0
- package/src/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.ts +21 -37
- package/src/business/interfaces/IDrawingToolsManager.ts +2 -3
- package/src/business/interfaces/IRestriction.ts +0 -1
- package/src/business/interfaces/ISnapRestriction.ts +9 -9
- package/src/index.ts +4 -4
- package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.d.ts +0 -7
- package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.d.ts.map +0 -1
- package/dist/api/implementation/restrictions/axis/AxisRestrictionApi.js.map +0 -1
- package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.d.ts +0 -22
- package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.d.ts.map +0 -1
- package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.js +0 -96
- package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.js.map +0 -1
- package/src/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.ts +0 -107
package/src/business/implementation/managers/interaction/restrictions/plane/snap/GridRestriction.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { AbstractRestriction } from '../../AbstractRestriction';
|
|
3
|
-
import { DrawingToolsManager } from '../../../../../DrawingToolsManager';
|
|
4
3
|
import { Box, sceneTree } from '@shapediver/viewer';
|
|
4
|
+
import { DrawingToolsManager } from '../../../../../DrawingToolsManager';
|
|
5
|
+
import { IRay } from '@shapediver/viewer.features.interaction';
|
|
5
6
|
import { ISnapRestriction, SnapRestrictionProperties } from '../../../../../../interfaces/ISnapRestriction';
|
|
6
7
|
import { PlaneRestriction } from '../PlaneRestriction';
|
|
8
|
+
import { RestrictionMetaData } from '../../../../../../interfaces/IRestriction';
|
|
7
9
|
import { vec3 } from 'gl-matrix';
|
|
8
10
|
|
|
9
11
|
// #region Type aliases (1)
|
|
@@ -29,7 +31,7 @@ export type GridRestrictionProperties = {
|
|
|
29
31
|
// #region Classes (1)
|
|
30
32
|
|
|
31
33
|
export class GridRestriction extends AbstractRestriction implements ISnapRestriction {
|
|
32
|
-
// #region Properties (
|
|
34
|
+
// #region Properties (10)
|
|
33
35
|
|
|
34
36
|
readonly #activationKey: string;
|
|
35
37
|
readonly #drawingToolsManager: DrawingToolsManager;
|
|
@@ -40,14 +42,10 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
40
42
|
#gridSize: number = 100;
|
|
41
43
|
#gridUnit: number;
|
|
42
44
|
#gridUnitEditable: boolean = true;
|
|
43
|
-
#normal: vec3;
|
|
44
45
|
#offsetFromUnit: vec3 = vec3.create();
|
|
45
|
-
#origin: vec3;
|
|
46
46
|
#priority: number = 0;
|
|
47
|
-
#vectorU: vec3;
|
|
48
|
-
#vectorV: vec3;
|
|
49
47
|
|
|
50
|
-
// #endregion Properties (
|
|
48
|
+
// #endregion Properties (10)
|
|
51
49
|
|
|
52
50
|
// #region Constructors (1)
|
|
53
51
|
|
|
@@ -57,14 +55,6 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
57
55
|
this.#drawingToolsManager = drawingToolsManager;
|
|
58
56
|
this.#planeRestriction = planeRestriction;
|
|
59
57
|
|
|
60
|
-
// we store the properties of the plane restriction
|
|
61
|
-
// as we need them to calculate the transformation matrices
|
|
62
|
-
// and the offset of the grid size to the origin
|
|
63
|
-
this.#vectorU = planeRestriction.vectorU!;
|
|
64
|
-
this.#vectorV = planeRestriction.vectorV!;
|
|
65
|
-
this.#normal = planeRestriction.normal;
|
|
66
|
-
this.#origin = planeRestriction.origin;
|
|
67
|
-
|
|
68
58
|
this.#activationKey = properties?.activationKey || 'g';
|
|
69
59
|
this.enabled = properties?.enabled ?? false;
|
|
70
60
|
this._enabledEditable = properties?.enabledEditable ?? true;
|
|
@@ -126,7 +116,7 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
126
116
|
// #region Public Methods (2)
|
|
127
117
|
|
|
128
118
|
// public get
|
|
129
|
-
public snap(point: vec3): vec3 | undefined {
|
|
119
|
+
public snap(ray: IRay, point: vec3, metaData: RestrictionMetaData): vec3 | undefined {
|
|
130
120
|
// if the restriction is not enabled OR the activation key is set and the key is not pressed, return
|
|
131
121
|
if (this.enabled === false && this.#drawingToolsManager.keyPressed(this.#activationKey) === false) return;
|
|
132
122
|
|
|
@@ -137,14 +127,13 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
137
127
|
*/
|
|
138
128
|
|
|
139
129
|
// vector from the point to the origin
|
|
140
|
-
const v = vec3.sub(vec3.create(), this.#origin, point);
|
|
130
|
+
const v = vec3.sub(vec3.create(), this.#planeRestriction.origin, point);
|
|
141
131
|
|
|
142
132
|
// dot product of the vector and the normal
|
|
143
|
-
const dot = vec3.dot(v, this.#normal);
|
|
133
|
+
const dot = vec3.dot(v, this.#planeRestriction.normal);
|
|
144
134
|
|
|
145
135
|
// projection of the origin onto the plane that is created by the point and the normal
|
|
146
|
-
const
|
|
147
|
-
const projectedOrigin = vec3.sub(vec3.create(), adjustedOrigin, vec3.scale(vec3.create(), this.#normal, dot));
|
|
136
|
+
const projectedOrigin = vec3.sub(vec3.create(), this.#planeRestriction.origin, vec3.scale(vec3.create(), this.#planeRestriction.normal, dot));
|
|
148
137
|
|
|
149
138
|
// we move the grid helper to the projected origin
|
|
150
139
|
if (this.#gridHelper) {
|
|
@@ -164,8 +153,8 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
164
153
|
|
|
165
154
|
// Snap the offset to the grid
|
|
166
155
|
const snappedOffset = vec3.create();
|
|
167
|
-
snappedOffset[0] = Math.round(rotatedPoint[0] / this.#gridUnit) * this.#gridUnit;
|
|
168
|
-
snappedOffset[1] = Math.round(rotatedPoint[1] / this.#gridUnit) * this.#gridUnit;
|
|
156
|
+
snappedOffset[0] = Math.round(rotatedPoint[0] / this.#gridUnit) * this.#gridUnit - this.#offsetFromUnit[0];
|
|
157
|
+
snappedOffset[1] = Math.round(rotatedPoint[1] / this.#gridUnit) * this.#gridUnit - this.#offsetFromUnit[1];
|
|
169
158
|
snappedOffset[2] = rotatedPoint[2];
|
|
170
159
|
|
|
171
160
|
// Move the snapped point back to the original coordinate system
|
|
@@ -174,12 +163,7 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
174
163
|
return snappedPoint;
|
|
175
164
|
}
|
|
176
165
|
|
|
177
|
-
public updatePlaneDefinition(
|
|
178
|
-
this.#origin = origin;
|
|
179
|
-
this.#vectorU = vectorU;
|
|
180
|
-
this.#vectorV = vectorV;
|
|
181
|
-
this.#normal = normal;
|
|
182
|
-
|
|
166
|
+
public updatePlaneDefinition(): void {
|
|
183
167
|
this.createOffsetFromUnit();
|
|
184
168
|
this.createGridVisualization();
|
|
185
169
|
}
|
|
@@ -207,8 +191,8 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
207
191
|
}
|
|
208
192
|
|
|
209
193
|
const bb = new Box();
|
|
210
|
-
for(let i = 0; i < sceneTree.root.children.length; i++) {
|
|
211
|
-
if((sceneTree.root.children[i] as unknown as { sessionNode?: boolean }).sessionNode === true) {
|
|
194
|
+
for (let i = 0; i < sceneTree.root.children.length; i++) {
|
|
195
|
+
if ((sceneTree.root.children[i] as unknown as { sessionNode?: boolean }).sessionNode === true) {
|
|
212
196
|
bb.union(sceneTree.root.children[i].boundingBox);
|
|
213
197
|
}
|
|
214
198
|
}
|
|
@@ -226,7 +210,7 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
226
210
|
|
|
227
211
|
// todo adjust grid size so that is divisible by grid unit
|
|
228
212
|
this.#gridHelper = new THREE.GridHelper(gridSize, gridSize / this.#gridUnit, 0x666666, 0x222222);
|
|
229
|
-
const adjustedOrigin = vec3.add(vec3.create(), this.#origin, this.#offsetFromUnit);
|
|
213
|
+
const adjustedOrigin = vec3.add(vec3.create(), this.#planeRestriction.origin, this.#offsetFromUnit);
|
|
230
214
|
this.#gridHelper.position.copy(new THREE.Vector3(adjustedOrigin[0], adjustedOrigin[1], adjustedOrigin[2]));
|
|
231
215
|
this.#gridHelper.visible = false;
|
|
232
216
|
|
|
@@ -236,9 +220,9 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
236
220
|
|
|
237
221
|
// three.js uses a right-handed coordinate system, so we need to rotate the grid helper
|
|
238
222
|
const rotationMatrix = new THREE.Matrix4().fromArray([
|
|
239
|
-
this.#vectorU[0], this.#vectorU[1], this.#vectorU[2], 0,
|
|
240
|
-
this.#vectorV[0], this.#vectorV[1], this.#vectorV[2], 0,
|
|
241
|
-
this.#normal[0], this.#normal[1], this.#normal[2], 0,
|
|
223
|
+
this.#planeRestriction.vectorU[0], this.#planeRestriction.vectorU[1], this.#planeRestriction.vectorU[2], 0,
|
|
224
|
+
this.#planeRestriction.vectorV[0], this.#planeRestriction.vectorV[1], this.#planeRestriction.vectorV[2], 0,
|
|
225
|
+
this.#planeRestriction.normal[0], this.#planeRestriction.normal[1], this.#planeRestriction.normal[2], 0,
|
|
242
226
|
0, 0, 0, 1
|
|
243
227
|
]);
|
|
244
228
|
|
|
@@ -251,9 +235,9 @@ export class GridRestriction extends AbstractRestriction implements ISnapRestric
|
|
|
251
235
|
|
|
252
236
|
private createOffsetFromUnit(): void {
|
|
253
237
|
// Calculate the offset of the rotated point from the rotated origin
|
|
254
|
-
this.#offsetFromUnit[0] = this.#gridUnit * Math.round(this.#origin[0] / this.#gridUnit) - this.#origin[0];
|
|
255
|
-
this.#offsetFromUnit[1] = this.#gridUnit * Math.round(this.#origin[1] / this.#gridUnit) - this.#origin[1];
|
|
256
|
-
this.#offsetFromUnit[2] = this.#gridUnit * Math.round(this.#origin[2] / this.#gridUnit) - this.#origin[2];
|
|
238
|
+
this.#offsetFromUnit[0] = this.#gridUnit * Math.round(this.#planeRestriction.origin[0] / this.#gridUnit) - this.#planeRestriction.origin[0];
|
|
239
|
+
this.#offsetFromUnit[1] = this.#gridUnit * Math.round(this.#planeRestriction.origin[1] / this.#gridUnit) - this.#planeRestriction.origin[1];
|
|
240
|
+
this.#offsetFromUnit[2] = this.#gridUnit * Math.round(this.#planeRestriction.origin[2] / this.#gridUnit) - this.#planeRestriction.origin[2];
|
|
257
241
|
}
|
|
258
242
|
|
|
259
243
|
// #endregion Private Methods (2)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxisRestrictionProperties } from '../implementation/managers/interaction/restrictions/axis/AxisRestriction';
|
|
2
1
|
import { GeometryRestrictionProperties } from '../implementation/managers/interaction/restrictions/geometry/GeometryRestriction';
|
|
3
2
|
import { IManager } from './IManager';
|
|
4
3
|
import { IMapData, IMaterialBasicLineDataProperties, IMaterialMultiPointDataProperties } from '@shapediver/viewer.shared.types';
|
|
@@ -125,9 +124,9 @@ export type Settings = {
|
|
|
125
124
|
* The restrictions of the drawing tool.
|
|
126
125
|
*
|
|
127
126
|
* Here you can define the restrictions that are used when interacting with the drawing tool.
|
|
128
|
-
* At least one restriction is required, the plane
|
|
127
|
+
* At least one restriction is required, the plane restriction is added by default if no restrictions are defined.
|
|
129
128
|
*/
|
|
130
|
-
restrictions: { [key: string]: RestrictionProperties | PlaneRestrictionProperties | GeometryRestrictionProperties
|
|
129
|
+
restrictions: { [key: string]: RestrictionProperties | PlaneRestrictionProperties | GeometryRestrictionProperties };
|
|
131
130
|
|
|
132
131
|
/**
|
|
133
132
|
* The visualization settings of the drawing tool.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IRay } from '@shapediver/viewer.features.interaction';
|
|
1
2
|
import { IRestrictionBase } from './IRestrictionBase';
|
|
2
3
|
import { RestrictionMetaData } from './IRestriction';
|
|
3
4
|
import { vec3 } from 'gl-matrix';
|
|
@@ -33,36 +34,35 @@ export type SnapRestrictionProperties = {
|
|
|
33
34
|
// #region Interfaces (1)
|
|
34
35
|
|
|
35
36
|
export interface ISnapRestriction extends IRestrictionBase {
|
|
36
|
-
// #region Properties (
|
|
37
|
+
// #region Properties (3)
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* If the restriction is actively being used at the moment.
|
|
41
|
+
*/
|
|
42
|
+
active: boolean;
|
|
38
43
|
/**
|
|
39
44
|
* If the enabling or disabling of the restriction is allowed to the end user.
|
|
40
45
|
* If it is not editable, the default value for enabling or disabling the restriction is used.
|
|
41
46
|
*/
|
|
42
47
|
enabledEditable: boolean;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* If the restriction is actively being used at the moment.
|
|
46
|
-
*/
|
|
47
|
-
active: boolean;
|
|
48
|
-
|
|
49
48
|
/**
|
|
50
49
|
* The priority of the restriction.
|
|
51
50
|
*/
|
|
52
51
|
priority: number;
|
|
53
52
|
|
|
54
|
-
// #endregion Properties (
|
|
53
|
+
// #endregion Properties (3)
|
|
55
54
|
|
|
56
55
|
// #region Public Methods (1)
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
58
|
* Restrict the position of a point.
|
|
60
59
|
*
|
|
60
|
+
* @param ray The ray that is used for the restriction.
|
|
61
61
|
* @param point The position of the point.
|
|
62
62
|
* @param metaData The meta data of the point.
|
|
63
63
|
* @returns The restricted position of the point.
|
|
64
64
|
*/
|
|
65
|
-
snap(point: vec3, metaData?: RestrictionMetaData): vec3 | undefined;
|
|
65
|
+
snap(ray: IRay, point: vec3, metaData?: RestrictionMetaData): vec3 | undefined;
|
|
66
66
|
|
|
67
67
|
// #endregion Public Methods (1)
|
|
68
68
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AngularRestrictionApi } from './api/implementation/restrictions/plane/snap/AngularRestrictionApi';
|
|
2
2
|
import { AngularRestrictionProperties } from './business/implementation/managers/interaction/restrictions/plane/snap/AngularRestriction';
|
|
3
|
-
import { AxisRestrictionApi } from './api/implementation/restrictions/
|
|
4
|
-
import { AxisRestrictionProperties } from './business/implementation/managers/interaction/restrictions/
|
|
3
|
+
import { AxisRestrictionApi } from './api/implementation/restrictions/plane/snap/AxisRestrictionApi';
|
|
4
|
+
import { AxisRestrictionProperties } from './business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction';
|
|
5
5
|
import { Callbacks, PointsData, SettingsOptional } from './business/interfaces/IDrawingToolsManager';
|
|
6
6
|
import { DrawingToolsApi } from './api/implementation/DrawingToolsApi';
|
|
7
7
|
import { DrawingToolsEventResponseMapping } from './business/interfaces/events/EventResponseMapping';
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
IViewportApi,
|
|
17
17
|
MaterialEngine,
|
|
18
18
|
ShapeDiverViewerDrawingToolsError
|
|
19
|
-
|
|
19
|
+
} from '@shapediver/viewer';
|
|
20
20
|
import {
|
|
21
21
|
IRestriction,
|
|
22
22
|
RESTRICTION_TYPE,
|
|
23
23
|
RestrictionMetaData,
|
|
24
24
|
RestrictionProperties
|
|
25
|
-
|
|
25
|
+
} from './business/interfaces/IRestriction';
|
|
26
26
|
import { IRestrictionApi } from './api/interfaces/IRestrictionApi';
|
|
27
27
|
import { IRestrictionBase } from './business/interfaces/IRestrictionBase';
|
|
28
28
|
import { ISnapRestriction, SnapRestrictionProperties } from './business/interfaces/ISnapRestriction';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AbstractRestrictionApi } from '../AbstractRestrictionApi';
|
|
2
|
-
import { AxisRestriction } from '../../../../business/implementation/managers/interaction/restrictions/axis/AxisRestriction';
|
|
3
|
-
export declare class AxisRestrictionApi extends AbstractRestrictionApi {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(restriction: AxisRestriction);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=AxisRestrictionApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AxisRestrictionApi.d.ts","sourceRoot":"","sources":["../../../../../src/api/implementation/restrictions/axis/AxisRestrictionApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4FAA4F,CAAC;AAE7H,qBAAa,kBAAmB,SAAQ,sBAAsB;;gBAS9C,WAAW,EAAE,eAAe;CAM3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AxisRestrictionApi.js","sourceRoot":"","sources":["../../../../../src/api/implementation/restrictions/axis/AxisRestrictionApi.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sEAAmE;AAGnE,MAAa,kBAAmB,SAAQ,+CAAsB;IAK1D,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,WAA4B;QACpC,KAAK,CAAC,WAAW,CAAC,CAAC;QATvB,yBAAyB;QAEzB,sDAA2C;QAQvC,uBAAA,IAAI,uCAAoB,WAAW,MAAA,CAAC;IACxC,CAAC;CAGJ;AAfD,gDAeC"}
|
package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AbstractRestriction } from '../AbstractRestriction';
|
|
2
|
-
import { DrawingToolsManager } from '../../../../DrawingToolsManager';
|
|
3
|
-
import { IRay } from '@shapediver/viewer.features.interaction';
|
|
4
|
-
import { IRestriction, RestrictionMetaData, RestrictionProperties } from '../../../../../interfaces/IRestriction';
|
|
5
|
-
import { ISnapRestriction } from '../../../../../interfaces/ISnapRestriction';
|
|
6
|
-
import { vec3 } from 'gl-matrix';
|
|
7
|
-
export declare type AxisRestrictionProperties = {
|
|
8
|
-
activationKeyX?: string;
|
|
9
|
-
activationKeyY?: string;
|
|
10
|
-
activationKeyZ?: string;
|
|
11
|
-
} & RestrictionProperties;
|
|
12
|
-
export declare class AxisRestriction extends AbstractRestriction implements IRestriction {
|
|
13
|
-
#private;
|
|
14
|
-
constructor(drawingToolsManager: DrawingToolsManager, id: string, properties: AxisRestrictionProperties);
|
|
15
|
-
get priority(): number;
|
|
16
|
-
get snapRestrictions(): {
|
|
17
|
-
[key: string]: ISnapRestriction;
|
|
18
|
-
};
|
|
19
|
-
rayTrace(ray: IRay, metaData?: RestrictionMetaData): vec3 | undefined;
|
|
20
|
-
protected visibilityChanged(): void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=AxisRestriction.d.ts.map
|
package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AxisRestriction.d.ts","sourceRoot":"","sources":["../../../../../../../src/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oBAAY,yBAAyB,GAAG;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,qBAAqB,CAAC;AAM1B,qBAAa,eAAgB,SAAQ,mBAAoB,YAAW,YAAY;;gBAehE,mBAAmB,EAAE,mBAAmB,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,yBAAyB;IAcvG,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,gBAAgB,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;KAAE,CAElE;IAMM,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS;IAwC5E,SAAS,CAAC,iBAAiB,IAAI,IAAI;CAGtC"}
|
package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _AxisRestriction_activationKeyX, _AxisRestriction_activationKeyY, _AxisRestriction_activationKeyZ, _AxisRestriction_drawingToolsManager, _AxisRestriction_geometryMathManager, _AxisRestriction_snapRestrictions;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AxisRestriction = void 0;
|
|
16
|
-
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
17
|
-
const gl_matrix_1 = require("gl-matrix");
|
|
18
|
-
// #endregion Type aliases (1)
|
|
19
|
-
// #region Classes (1)
|
|
20
|
-
class AxisRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
21
|
-
// #endregion Properties (7)
|
|
22
|
-
// #region Constructors (1)
|
|
23
|
-
constructor(drawingToolsManager, id, properties) {
|
|
24
|
-
super(drawingToolsManager, id);
|
|
25
|
-
// #region Properties (7)
|
|
26
|
-
_AxisRestriction_activationKeyX.set(this, void 0);
|
|
27
|
-
_AxisRestriction_activationKeyY.set(this, void 0);
|
|
28
|
-
_AxisRestriction_activationKeyZ.set(this, void 0);
|
|
29
|
-
_AxisRestriction_drawingToolsManager.set(this, void 0);
|
|
30
|
-
_AxisRestriction_geometryMathManager.set(this, void 0);
|
|
31
|
-
_AxisRestriction_snapRestrictions.set(this, {});
|
|
32
|
-
__classPrivateFieldSet(this, _AxisRestriction_drawingToolsManager, drawingToolsManager, "f");
|
|
33
|
-
__classPrivateFieldSet(this, _AxisRestriction_geometryMathManager, drawingToolsManager.geometryMathManager, "f");
|
|
34
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyX, properties.activationKeyX || 'x', "f");
|
|
35
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyY, properties.activationKeyY || 'y', "f");
|
|
36
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyZ, properties.activationKeyZ || 'z', "f");
|
|
37
|
-
}
|
|
38
|
-
// #endregion Constructors (1)
|
|
39
|
-
// #region Public Getters And Setters (2)
|
|
40
|
-
get priority() {
|
|
41
|
-
return 1;
|
|
42
|
-
}
|
|
43
|
-
get snapRestrictions() {
|
|
44
|
-
return __classPrivateFieldGet(this, _AxisRestriction_snapRestrictions, "f");
|
|
45
|
-
}
|
|
46
|
-
// #endregion Public Getters And Setters (2)
|
|
47
|
-
// #region Public Methods (1)
|
|
48
|
-
rayTrace(ray, metaData) {
|
|
49
|
-
if (this.enabled === false)
|
|
50
|
-
return;
|
|
51
|
-
if (!metaData || !metaData.referencePoint)
|
|
52
|
-
return;
|
|
53
|
-
const xPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(__classPrivateFieldGet(this, _AxisRestriction_activationKeyX, "f"));
|
|
54
|
-
const yPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(__classPrivateFieldGet(this, _AxisRestriction_activationKeyY, "f"));
|
|
55
|
-
const zPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(__classPrivateFieldGet(this, _AxisRestriction_activationKeyZ, "f"));
|
|
56
|
-
const xyPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(`${__classPrivateFieldGet(this, _AxisRestriction_activationKeyX, "f")}+${__classPrivateFieldGet(this, _AxisRestriction_activationKeyY, "f")}`);
|
|
57
|
-
const xzPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(`${__classPrivateFieldGet(this, _AxisRestriction_activationKeyX, "f")}+${__classPrivateFieldGet(this, _AxisRestriction_activationKeyZ, "f")}`);
|
|
58
|
-
const yzPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(`${__classPrivateFieldGet(this, _AxisRestriction_activationKeyY, "f")}+${__classPrivateFieldGet(this, _AxisRestriction_activationKeyZ, "f")}`);
|
|
59
|
-
const xyzPressed = __classPrivateFieldGet(this, _AxisRestriction_drawingToolsManager, "f").keyPressed(`${__classPrivateFieldGet(this, _AxisRestriction_activationKeyX, "f")}+${__classPrivateFieldGet(this, _AxisRestriction_activationKeyY, "f")}+${__classPrivateFieldGet(this, _AxisRestriction_activationKeyZ, "f")}`);
|
|
60
|
-
if (xPressed) {
|
|
61
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(1, 0, 0) });
|
|
62
|
-
return closestPointOnRay2;
|
|
63
|
-
}
|
|
64
|
-
else if (yPressed) {
|
|
65
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(0, 1, 0) });
|
|
66
|
-
return closestPointOnRay2;
|
|
67
|
-
}
|
|
68
|
-
else if (zPressed) {
|
|
69
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(0, 0, 1) });
|
|
70
|
-
return closestPointOnRay2;
|
|
71
|
-
}
|
|
72
|
-
else if (xyPressed) {
|
|
73
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(1, 1, 0) });
|
|
74
|
-
return closestPointOnRay2;
|
|
75
|
-
}
|
|
76
|
-
else if (xzPressed) {
|
|
77
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(1, 0, 1) });
|
|
78
|
-
return closestPointOnRay2;
|
|
79
|
-
}
|
|
80
|
-
else if (yzPressed) {
|
|
81
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(0, 1, 1) });
|
|
82
|
-
return closestPointOnRay2;
|
|
83
|
-
}
|
|
84
|
-
else if (xyzPressed) {
|
|
85
|
-
const { closestPointOnRay2 } = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: gl_matrix_1.vec3.fromValues(1, 1, 1) });
|
|
86
|
-
return closestPointOnRay2;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// #endregion Public Methods (1)
|
|
90
|
-
// #region Protected Methods (1)
|
|
91
|
-
visibilityChanged() { }
|
|
92
|
-
}
|
|
93
|
-
exports.AxisRestriction = AxisRestriction;
|
|
94
|
-
_AxisRestriction_activationKeyX = new WeakMap(), _AxisRestriction_activationKeyY = new WeakMap(), _AxisRestriction_activationKeyZ = new WeakMap(), _AxisRestriction_drawingToolsManager = new WeakMap(), _AxisRestriction_geometryMathManager = new WeakMap(), _AxisRestriction_snapRestrictions = new WeakMap();
|
|
95
|
-
// #endregion Classes (1)
|
|
96
|
-
//# sourceMappingURL=AxisRestriction.js.map
|
package/dist/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AxisRestriction.js","sourceRoot":"","sources":["../../../../../../../src/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA6D;AAM7D,yCAAiC;AAUjC,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,eAAgB,SAAQ,yCAAmB;IAWpD,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,mBAAwC,EAAE,EAAU,EAAE,UAAqC;QACnG,KAAK,CAAC,mBAAmB,EAAE,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;SAC7B;IACL,CAAC;IAED,gCAAgC;IAEhC,gCAAgC;IAEtB,iBAAiB,KAAW,CAAC;CAG1C;AApFD,0CAoFC;;AAED,yBAAyB"}
|
package/src/business/implementation/managers/interaction/restrictions/axis/AxisRestriction.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { AbstractRestriction } from '../AbstractRestriction';
|
|
2
|
-
import { DrawingToolsManager } from '../../../../DrawingToolsManager';
|
|
3
|
-
import { GeometryMathManager } from '../../../geometry/GeometryMathManager';
|
|
4
|
-
import { IRay } from '@shapediver/viewer.features.interaction';
|
|
5
|
-
import { IRestriction, RestrictionMetaData, RestrictionProperties } from '../../../../../interfaces/IRestriction';
|
|
6
|
-
import { ISnapRestriction } from '../../../../../interfaces/ISnapRestriction';
|
|
7
|
-
import { vec3 } from 'gl-matrix';
|
|
8
|
-
|
|
9
|
-
// #region Type aliases (1)
|
|
10
|
-
|
|
11
|
-
export type AxisRestrictionProperties = {
|
|
12
|
-
activationKeyX?: string;
|
|
13
|
-
activationKeyY?: string;
|
|
14
|
-
activationKeyZ?: string;
|
|
15
|
-
} & RestrictionProperties;
|
|
16
|
-
|
|
17
|
-
// #endregion Type aliases (1)
|
|
18
|
-
|
|
19
|
-
// #region Classes (1)
|
|
20
|
-
|
|
21
|
-
export class AxisRestriction extends AbstractRestriction implements IRestriction {
|
|
22
|
-
// #region Properties (7)
|
|
23
|
-
|
|
24
|
-
readonly #activationKeyX: string;
|
|
25
|
-
readonly #activationKeyY: string;
|
|
26
|
-
readonly #activationKeyZ: string;
|
|
27
|
-
readonly #drawingToolsManager: DrawingToolsManager;
|
|
28
|
-
|
|
29
|
-
#geometryMathManager: GeometryMathManager;
|
|
30
|
-
#snapRestrictions: { [key: string]: ISnapRestriction; } = {};
|
|
31
|
-
|
|
32
|
-
// #endregion Properties (7)
|
|
33
|
-
|
|
34
|
-
// #region Constructors (1)
|
|
35
|
-
|
|
36
|
-
constructor(drawingToolsManager: DrawingToolsManager, id: string, properties: AxisRestrictionProperties) {
|
|
37
|
-
super(drawingToolsManager, id);
|
|
38
|
-
this.#drawingToolsManager = drawingToolsManager;
|
|
39
|
-
this.#geometryMathManager = drawingToolsManager.geometryMathManager;
|
|
40
|
-
|
|
41
|
-
this.#activationKeyX = properties.activationKeyX || 'x';
|
|
42
|
-
this.#activationKeyY = properties.activationKeyY || 'y';
|
|
43
|
-
this.#activationKeyZ = properties.activationKeyZ || 'z';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// #endregion Constructors (1)
|
|
47
|
-
|
|
48
|
-
// #region Public Getters And Setters (2)
|
|
49
|
-
|
|
50
|
-
public get priority(): number {
|
|
51
|
-
return 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public get snapRestrictions(): { [key: string]: ISnapRestriction; } {
|
|
55
|
-
return this.#snapRestrictions;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// #endregion Public Getters And Setters (2)
|
|
59
|
-
|
|
60
|
-
// #region Public Methods (1)
|
|
61
|
-
|
|
62
|
-
public rayTrace(ray: IRay, metaData?: RestrictionMetaData): vec3 | undefined {
|
|
63
|
-
if (this.enabled === false) return;
|
|
64
|
-
if (!metaData || !metaData.referencePoint) return;
|
|
65
|
-
|
|
66
|
-
const xPressed = this.#drawingToolsManager.keyPressed(this.#activationKeyX);
|
|
67
|
-
const yPressed = this.#drawingToolsManager.keyPressed(this.#activationKeyY);
|
|
68
|
-
const zPressed = this.#drawingToolsManager.keyPressed(this.#activationKeyZ);
|
|
69
|
-
const xyPressed = this.#drawingToolsManager.keyPressed(`${this.#activationKeyX}+${this.#activationKeyY}`);
|
|
70
|
-
const xzPressed = this.#drawingToolsManager.keyPressed(`${this.#activationKeyX}+${this.#activationKeyZ}`);
|
|
71
|
-
const yzPressed = this.#drawingToolsManager.keyPressed(`${this.#activationKeyY}+${this.#activationKeyZ}`);
|
|
72
|
-
const xyzPressed = this.#drawingToolsManager.keyPressed(`${this.#activationKeyX}+${this.#activationKeyY}+${this.#activationKeyZ}`);
|
|
73
|
-
|
|
74
|
-
if (xPressed) {
|
|
75
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(1, 0, 0) });
|
|
76
|
-
return closestPointOnRay2;
|
|
77
|
-
} else if (yPressed) {
|
|
78
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(0, 1, 0) });
|
|
79
|
-
return closestPointOnRay2;
|
|
80
|
-
} else if (zPressed) {
|
|
81
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(0, 0, 1) });
|
|
82
|
-
return closestPointOnRay2;
|
|
83
|
-
} else if (xyPressed) {
|
|
84
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(1, 1, 0) });
|
|
85
|
-
return closestPointOnRay2;
|
|
86
|
-
} else if (xzPressed) {
|
|
87
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(1, 0, 1) });
|
|
88
|
-
return closestPointOnRay2;
|
|
89
|
-
} else if (yzPressed) {
|
|
90
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(0, 1, 1) });
|
|
91
|
-
return closestPointOnRay2;
|
|
92
|
-
} else if (xyzPressed) {
|
|
93
|
-
const { closestPointOnRay2 } = this.#geometryMathManager.closestPointsRayRay(ray, { origin: metaData.referencePoint, direction: vec3.fromValues(1, 1, 1) });
|
|
94
|
-
return closestPointOnRay2;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// #endregion Public Methods (1)
|
|
99
|
-
|
|
100
|
-
// #region Protected Methods (1)
|
|
101
|
-
|
|
102
|
-
protected visibilityChanged(): void { }
|
|
103
|
-
|
|
104
|
-
// #endregion Protected Methods (1)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// #endregion Classes (1)
|