@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDrawingToolsManager.d.ts","sourceRoot":"","sources":["../../../src/business/interfaces/IDrawingToolsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"IDrawingToolsManager.d.ts","sourceRoot":"","sources":["../../../src/business/interfaces/IDrawingToolsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AACjI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,MAAM,iCAAiC,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4EAA4E,CAAC;AACxH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;GAMG;AACH,oBAAY,SAAS,GAAG;IACpB;;OAEG;IACH,QAAQ,IAAI,IAAI,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC1C,CAAC;AACF,oBAAY,eAAe,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;CAAE,CAAA;AAE7E;;;;;;GAMG;AACH,oBAAY,UAAU,GAAG,MAAM,EAAE,EAAE,CAAC;AACpC;;;;;;GAMG;AACH,oBAAY,QAAQ,GAAG;IACnB;;;;OAIG;IACH,QAAQ,EAAE;QACN;;;;;;;;;WASG;QACH,MAAM,EAAE,UAAU,CAAC;QAEnB;;;;;;;WAOG;QACH,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;QAEzB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;;;;WAKG;QACH,SAAS,CAAC,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tD,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,UAAU,GAAG,SAAS,CAAC;CAGpC;AAMD,oBAAY,cAAc;IACtB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,QAAQ,IAAI;IACZ,gBAAgB,IAAI;IACpB,SAAS,IAAI;IACb,iBAAiB,IAAI;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDrawingToolsManager.js","sourceRoot":"","sources":["../../../src/business/interfaces/IDrawingToolsManager.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IDrawingToolsManager.js","sourceRoot":"","sources":["../../../src/business/interfaces/IDrawingToolsManager.ts"],"names":[],"mappings":";;;AA0SA,4BAA4B;AAE5B,oBAAoB;AAEpB,IAAY,cAOX;AAPD,WAAY,cAAc;IACtB,yDAAW,CAAA;IACX,yDAAW,CAAA;IACX,2DAAY,CAAA;IACZ,2EAAoB,CAAA;IACpB,6DAAa,CAAA;IACb,6EAAqB,CAAA;AACzB,CAAC,EAPW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAOzB;AAED,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRestriction.d.ts","sourceRoot":"","sources":["../../../src/business/interfaces/IRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oBAAY,mBAAmB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,IAAI,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GAAG,IAAI,GAAG,SAAS,CAAC;CAGzE;AAMD,oBAAY,gBAAgB;IACxB,KAAK,UAAU;IACf,QAAQ,aAAa;CACxB"}
|
|
@@ -5,7 +5,6 @@ exports.RESTRICTION_TYPE = void 0;
|
|
|
5
5
|
// #region Enums (1)
|
|
6
6
|
var RESTRICTION_TYPE;
|
|
7
7
|
(function (RESTRICTION_TYPE) {
|
|
8
|
-
RESTRICTION_TYPE["AXIS"] = "axis";
|
|
9
8
|
RESTRICTION_TYPE["PLANE"] = "plane";
|
|
10
9
|
RESTRICTION_TYPE["GEOMETRY"] = "geometry";
|
|
11
10
|
})(RESTRICTION_TYPE = exports.RESTRICTION_TYPE || (exports.RESTRICTION_TYPE = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRestriction.js","sourceRoot":"","sources":["../../../src/business/interfaces/IRestriction.ts"],"names":[],"mappings":";;;AAqDA,4BAA4B;AAE5B,oBAAoB;AAEpB,IAAY,
|
|
1
|
+
{"version":3,"file":"IRestriction.js","sourceRoot":"","sources":["../../../src/business/interfaces/IRestriction.ts"],"names":[],"mappings":";;;AAqDA,4BAA4B;AAE5B,oBAAoB;AAEpB,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,mCAAe,CAAA;IACf,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAED,uBAAuB"}
|
|
@@ -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';
|
|
@@ -25,15 +26,15 @@ export declare type SnapRestrictionProperties = {
|
|
|
25
26
|
activationKey?: string;
|
|
26
27
|
};
|
|
27
28
|
export interface ISnapRestriction extends IRestrictionBase {
|
|
29
|
+
/**
|
|
30
|
+
* If the restriction is actively being used at the moment.
|
|
31
|
+
*/
|
|
32
|
+
active: boolean;
|
|
28
33
|
/**
|
|
29
34
|
* If the enabling or disabling of the restriction is allowed to the end user.
|
|
30
35
|
* If it is not editable, the default value for enabling or disabling the restriction is used.
|
|
31
36
|
*/
|
|
32
37
|
enabledEditable: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* If the restriction is actively being used at the moment.
|
|
35
|
-
*/
|
|
36
|
-
active: boolean;
|
|
37
38
|
/**
|
|
38
39
|
* The priority of the restriction.
|
|
39
40
|
*/
|
|
@@ -41,10 +42,11 @@ export interface ISnapRestriction extends IRestrictionBase {
|
|
|
41
42
|
/**
|
|
42
43
|
* Restrict the position of a point.
|
|
43
44
|
*
|
|
45
|
+
* @param ray The ray that is used for the restriction.
|
|
44
46
|
* @param point The position of the point.
|
|
45
47
|
* @param metaData The meta data of the point.
|
|
46
48
|
* @returns The restricted position of the point.
|
|
47
49
|
*/
|
|
48
|
-
snap(point: vec3, metaData?: RestrictionMetaData): vec3 | undefined;
|
|
50
|
+
snap(ray: IRay, point: vec3, metaData?: RestrictionMetaData): vec3 | undefined;
|
|
49
51
|
}
|
|
50
52
|
//# sourceMappingURL=ISnapRestriction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISnapRestriction.d.ts","sourceRoot":"","sources":["../../../src/business/interfaces/ISnapRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oBAAY,yBAAyB,GAAG;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAMF,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IAGtD
|
|
1
|
+
{"version":3,"file":"ISnapRestriction.d.ts","sourceRoot":"","sources":["../../../src/business/interfaces/ISnapRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oBAAY,yBAAyB,GAAG;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAMF,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IAGtD;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAMjB;;;;;;;OAOG;IACH,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;CAGlF"}
|
package/dist/index.d.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';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oEAAoE,CAAC;AAC3G,OAAO,EAAE,4BAA4B,EAAE,MAAM,2FAA2F,CAAC;AACzI,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oEAAoE,CAAC;AAC3G,OAAO,EAAE,4BAA4B,EAAE,MAAM,2FAA2F,CAAC;AACzI,OAAO,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wFAAwF,CAAC;AACnI,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mDAAmD,CAAC;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mEAAmE,CAAC;AAC3G,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wFAAwF,CAAC;AACnI,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAEH,YAAY,EAGf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,oFAAoF,CAAC;AAGhI,OAAO,EACH,gBAAgB,IAAI,QAAQ,EAAE,SAAS,EACvC,gCAAgC,EAAE,kBAAkB,EACpD,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAC7C,0BAA0B,EAAE,yBAAyB,EAAE,4BAA4B,EACnF,6BAA6B,EAC7B,yBAAyB,EACzB,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAC3H,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,gBAAgB,GAC5I,CAAC;AAYF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,aAAc,YAAY,aAAa,SAAS,YAAY,gBAAgB,KAAG,gBAS7G,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createDrawingTools = exports.RESTRICTION_TYPE = exports.AxisRestrictionApi = exports.GeometryRestrictionApi = exports.AngularRestrictionApi = exports.GridRestrictionApi = exports.PlaneRestrictionApi = exports.DrawingToolsApi = void 0;
|
|
4
4
|
const AngularRestrictionApi_1 = require("./api/implementation/restrictions/plane/snap/AngularRestrictionApi");
|
|
5
5
|
Object.defineProperty(exports, "AngularRestrictionApi", { enumerable: true, get: function () { return AngularRestrictionApi_1.AngularRestrictionApi; } });
|
|
6
|
-
const AxisRestrictionApi_1 = require("./api/implementation/restrictions/
|
|
6
|
+
const AxisRestrictionApi_1 = require("./api/implementation/restrictions/plane/snap/AxisRestrictionApi");
|
|
7
7
|
Object.defineProperty(exports, "AxisRestrictionApi", { enumerable: true, get: function () { return AxisRestrictionApi_1.AxisRestrictionApi; } });
|
|
8
8
|
const DrawingToolsApi_1 = require("./api/implementation/DrawingToolsApi");
|
|
9
9
|
Object.defineProperty(exports, "DrawingToolsApi", { enumerable: true, get: function () { return DrawingToolsApi_1.DrawingToolsApi; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8GAA2G;AAuC7C,sGAvCrD,6CAAqB,OAuCqD;AArCnF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8GAA2G;AAuC7C,sGAvCrD,6CAAqB,OAuCqD;AArCnF,wGAAqG;AAqCQ,mGArCpG,uCAAkB,OAqCoG;AAlC/H,0EAAuE;AA8BjD,gGA9Bb,iCAAe,OA8Ba;AA5BrC,8GAA2G;AAgCtB,uGAhC5E,+CAAsB,OAgC4E;AA9B3G,wGAAqG;AA8B3D,mGA9BjC,uCAAkB,OA8BiC;AA1B5D,+CAK4B;AAC5B,qEAK4C;AAgBoC,iGAnB5E,+BAAgB,OAmB4E;AAZhG,qGAAkG;AAW7E,oGAXZ,yCAAmB,OAWY;AATxC,+EAAgE;AAahE,MAAM,eAAe,GAAoD,EAAE,CAAC;AAE5E,eAAe,CAAC,aAAa,CAAC,GAAG,uBAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,0DAA0D,CAAC;KACvH,IAAI,CAAC,CAAC,OAAwB,EAAE,EAAE;IAC/B,eAAe,CAAC,aAAa,CAAC,GAAG,OAAQ,CAAC;IAC1C,OAAO,OAAQ,CAAC;AACpB,CAAC,CAAC,CAAC;AAEP,IAAI,YAA0C,CAAC;AAE/C;;;;;;;;GAQG;AACI,MAAM,kBAAkB,GAAG,CAAC,QAAsB,EAAE,SAAoB,EAAE,QAA0B,EAAoB,EAAE;IAC7H,IAAI,mCAAU,CAAC,QAAQ,CAAC,QAAQ;QAC5B,MAAM,IAAI,0CAAiC,CAAC,uDAAuD,CAAC,CAAC;IAEzG,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,KAAK;QAC7C,MAAM,IAAI,0CAAiC,CAAC,+HAA+H,CAAC,CAAC;IAEjL,YAAY,GAAG,IAAI,iCAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IACnF,OAAO,YAAY,CAAC;AACxB,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapediver/viewer.features.drawing-tools",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"testEnvironment": "node"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@shapediver/viewer": "3.
|
|
45
|
-
"@shapediver/viewer.features.interaction": "3.
|
|
46
|
-
"@shapediver/viewer.rendering-engine.rendering-engine-threejs": "3.
|
|
47
|
-
"@shapediver/viewer.shared.math": "3.
|
|
48
|
-
"@shapediver/viewer.shared.node-tree": "3.
|
|
49
|
-
"@shapediver/viewer.shared.services": "3.
|
|
50
|
-
"@shapediver/viewer.shared.types": "3.
|
|
44
|
+
"@shapediver/viewer": "3.2.0",
|
|
45
|
+
"@shapediver/viewer.features.interaction": "3.2.0",
|
|
46
|
+
"@shapediver/viewer.rendering-engine.rendering-engine-threejs": "3.2.0",
|
|
47
|
+
"@shapediver/viewer.shared.math": "3.2.0",
|
|
48
|
+
"@shapediver/viewer.shared.node-tree": "3.2.0",
|
|
49
|
+
"@shapediver/viewer.shared.services": "3.2.0",
|
|
50
|
+
"@shapediver/viewer.shared.types": "3.2.0",
|
|
51
51
|
"@types/three": "0.162.0",
|
|
52
52
|
"three": "0.162.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "36007f976342f0390133d7e5cecf4ebf79905c8a"
|
|
55
55
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { AxisRestriction } from '../../business/implementation/managers/interaction/restrictions/axis/AxisRestriction';
|
|
2
|
-
import { AxisRestrictionApi } from './restrictions/axis/AxisRestrictionApi';
|
|
3
1
|
import {
|
|
4
2
|
Callbacks,
|
|
5
3
|
DefaultTextures,
|
|
@@ -17,6 +15,7 @@ import { PlaneRestriction } from '../../business/implementation/managers/interac
|
|
|
17
15
|
import { PlaneRestrictionApi } from './restrictions/plane/PlaneRestrictionApi';
|
|
18
16
|
import { RestrictionProperties } from '../../business/interfaces/IRestriction';
|
|
19
17
|
import { vec3 } from 'gl-matrix';
|
|
18
|
+
|
|
20
19
|
export class DrawingToolsApi implements IDrawingToolsApi {
|
|
21
20
|
// #region Properties (2)
|
|
22
21
|
|
|
@@ -35,8 +34,6 @@ export class DrawingToolsApi implements IDrawingToolsApi {
|
|
|
35
34
|
this.#restrictions[token] = new PlaneRestrictionApi(this.#drawingToolsManager.restrictions[token] as PlaneRestriction);
|
|
36
35
|
if (this.#drawingToolsManager.restrictions[token] instanceof GeometryRestriction)
|
|
37
36
|
this.#restrictions[token] = new GeometryRestrictionApi(this.#drawingToolsManager.restrictions[token] as GeometryRestriction);
|
|
38
|
-
if (this.#drawingToolsManager.restrictions[token] instanceof AxisRestriction)
|
|
39
|
-
this.#restrictions[token] = new AxisRestrictionApi(this.#drawingToolsManager.restrictions[token] as AxisRestriction);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
|
|
@@ -88,8 +85,6 @@ export class DrawingToolsApi implements IDrawingToolsApi {
|
|
|
88
85
|
this.#restrictions[token] = new PlaneRestrictionApi(this.#drawingToolsManager.restrictions[token] as PlaneRestriction);
|
|
89
86
|
if (this.#drawingToolsManager.restrictions[token] instanceof GeometryRestriction)
|
|
90
87
|
this.#restrictions[token] = new GeometryRestrictionApi(this.#drawingToolsManager.restrictions[token] as GeometryRestriction);
|
|
91
|
-
if (this.#drawingToolsManager.restrictions[token] instanceof AxisRestriction)
|
|
92
|
-
this.#restrictions[token] = new AxisRestrictionApi(this.#drawingToolsManager.restrictions[token] as AxisRestriction);
|
|
93
88
|
|
|
94
89
|
return this.#restrictions[token];
|
|
95
90
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { AbstractRestrictionApi } from '../AbstractRestrictionApi';
|
|
2
2
|
import { AngularRestrictionApi } from './snap/AngularRestrictionApi';
|
|
3
|
+
import { AxisRestrictionApi } from './snap/AxisRestrictionApi';
|
|
3
4
|
import { GridRestrictionApi } from './snap/GridRestrictionApi';
|
|
4
5
|
import { PlaneRestriction } from '../../../../business/implementation/managers/interaction/restrictions/plane/PlaneRestriction';
|
|
5
6
|
import { vec3 } from 'gl-matrix';
|
|
6
7
|
|
|
7
8
|
export class PlaneRestrictionApi extends AbstractRestrictionApi {
|
|
8
|
-
// #region Properties (
|
|
9
|
+
// #region Properties (4)
|
|
9
10
|
|
|
10
11
|
readonly #angularRestrictionApi: AngularRestrictionApi;
|
|
12
|
+
readonly #axisRestrictionApi: AxisRestrictionApi;
|
|
11
13
|
readonly #gridRestrictionApi: GridRestrictionApi;
|
|
12
14
|
readonly #planeRestriction: PlaneRestriction;
|
|
13
15
|
|
|
14
|
-
// #endregion Properties (
|
|
16
|
+
// #endregion Properties (4)
|
|
15
17
|
|
|
16
18
|
// #region Constructors (1)
|
|
17
19
|
|
|
@@ -21,20 +23,33 @@ export class PlaneRestrictionApi extends AbstractRestrictionApi {
|
|
|
21
23
|
|
|
22
24
|
this.#gridRestrictionApi = new GridRestrictionApi(restriction.gridRestriction);
|
|
23
25
|
this.#angularRestrictionApi = new AngularRestrictionApi(restriction.angularRestriction);
|
|
26
|
+
this.#axisRestrictionApi = new AxisRestrictionApi(restriction.axisRestriction);
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
// #endregion Constructors (1)
|
|
27
30
|
|
|
28
|
-
// #region Public Getters And Setters (
|
|
31
|
+
// #region Public Getters And Setters (9)
|
|
29
32
|
|
|
30
33
|
public get angularRestrictionApi(): AngularRestrictionApi {
|
|
31
34
|
return this.#angularRestrictionApi;
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
public get axisRestrictionApi(): AxisRestrictionApi {
|
|
38
|
+
return this.#axisRestrictionApi;
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
public get gridRestrictionApi(): GridRestrictionApi {
|
|
35
42
|
return this.#gridRestrictionApi;
|
|
36
43
|
}
|
|
37
44
|
|
|
45
|
+
public get origin(): vec3 {
|
|
46
|
+
return this.#planeRestriction.origin;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public set origin(value: vec3) {
|
|
50
|
+
this.#planeRestriction.origin = value;
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
public get vectorU(): vec3 {
|
|
39
54
|
return this.#planeRestriction.vectorU;
|
|
40
55
|
}
|
|
@@ -51,13 +66,5 @@ export class PlaneRestrictionApi extends AbstractRestrictionApi {
|
|
|
51
66
|
this.#planeRestriction.vectorV = value;
|
|
52
67
|
}
|
|
53
68
|
|
|
54
|
-
|
|
55
|
-
return this.#planeRestriction.origin;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public set origin(value: vec3) {
|
|
59
|
-
this.#planeRestriction.origin = value;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// #endregion Public Getters And Setters (8)
|
|
69
|
+
// #endregion Public Getters And Setters (9)
|
|
63
70
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AxisRestriction } from '
|
|
1
|
+
import { AbstractSnapRestrictionApi } from '../../AbstractSnapRestrictionApi';
|
|
2
|
+
import { AxisRestriction } from '../../../../../business/implementation/managers/interaction/restrictions/plane/snap/AxisRestriction';
|
|
3
3
|
|
|
4
|
-
export class AxisRestrictionApi extends
|
|
4
|
+
export class AxisRestrictionApi extends AbstractSnapRestrictionApi {
|
|
5
5
|
// #region Properties (1)
|
|
6
6
|
|
|
7
7
|
readonly #axisRestriction: AxisRestriction;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxisRestrictionProperties } from '../../business/implementation/managers/interaction/restrictions/axis/AxisRestriction';
|
|
2
1
|
import { GeometryRestrictionProperties } from '../../business/implementation/managers/interaction/restrictions/geometry/GeometryRestriction';
|
|
3
2
|
import { IRestrictionApi } from './IRestrictionApi';
|
|
4
3
|
import { PlaneRestrictionProperties } from '../../business/implementation/managers/interaction/restrictions/plane/PlaneRestriction';
|
|
@@ -51,7 +50,7 @@ export interface IDrawingToolsApi {
|
|
|
51
50
|
* @param token The token of the restriction.
|
|
52
51
|
* @returns The api of the restriction.
|
|
53
52
|
*/
|
|
54
|
-
addRestriction(properties: RestrictionProperties | PlaneRestrictionProperties | GeometryRestrictionProperties
|
|
53
|
+
addRestriction(properties: RestrictionProperties | PlaneRestrictionProperties | GeometryRestrictionProperties, token?: string): IRestrictionApi | undefined;
|
|
55
54
|
/**
|
|
56
55
|
* Check if the drawing tool can redo the last action.
|
|
57
56
|
*/
|
|
@@ -585,7 +585,6 @@ export class DrawingToolsManager implements IDrawingToolsManager {
|
|
|
585
585
|
|
|
586
586
|
if (settingsOptional.restrictions === undefined || Object.keys(settingsOptional.restrictions).length === 0) {
|
|
587
587
|
settings.restrictions['plane'] = { type: RESTRICTION_TYPE.PLANE };
|
|
588
|
-
settings.restrictions['axis'] = { type: RESTRICTION_TYPE.AXIS };
|
|
589
588
|
} else {
|
|
590
589
|
settings.restrictions = settingsOptional.restrictions as { [key: string]: RestrictionProperties };
|
|
591
590
|
}
|
|
@@ -178,21 +178,33 @@ export class TextVisualizationManager implements IManager {
|
|
|
178
178
|
const child = document.createElement('div');
|
|
179
179
|
child.className = 'distance-label';
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
background-color: ${this.#settings.visualization.points.color_1}80;
|
|
189
|
-
border-radius: 5px;
|
|
190
|
-
font-size: 16px;
|
|
191
|
-
text-align: center;
|
|
192
|
-
padding: 0px 2px;
|
|
181
|
+
// check if there is already a style tag in the head that defined the style for the point label
|
|
182
|
+
// if not, create one
|
|
183
|
+
let styleExists = false;
|
|
184
|
+
document.head.querySelectorAll('style').forEach(style => {
|
|
185
|
+
if (style.textContent?.includes('.distance-label')) {
|
|
186
|
+
styleExists = true;
|
|
187
|
+
return;
|
|
193
188
|
}
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
if(!styleExists) {
|
|
192
|
+
const style = document.createElement('style');
|
|
193
|
+
style.textContent = `
|
|
194
|
+
.distance-label {
|
|
195
|
+
display: flex;
|
|
196
|
+
justify-content: center;
|
|
197
|
+
align-items: center;
|
|
198
|
+
color: white;
|
|
199
|
+
background-color: ${this.#settings.visualization.points.color_1}80;
|
|
200
|
+
border-radius: 5px;
|
|
201
|
+
font-size: 16px;
|
|
202
|
+
text-align: center;
|
|
203
|
+
padding: 0px 2px;
|
|
204
|
+
}
|
|
205
|
+
`;
|
|
206
|
+
document.head.appendChild(style);
|
|
207
|
+
}
|
|
196
208
|
|
|
197
209
|
child.textContent = `${numberCleaner(vec3.distance(firstPoint, secondPoint))}${this.#settings.general.displayUnit}`;
|
|
198
210
|
text.appendChild(child);
|
|
@@ -216,21 +228,33 @@ export class TextVisualizationManager implements IManager {
|
|
|
216
228
|
const child = document.createElement('div');
|
|
217
229
|
child.className = 'point-label';
|
|
218
230
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
background-color: ${this.#settings.visualization.points.color_1}80;
|
|
227
|
-
border-radius: 5px;
|
|
228
|
-
font-size: 16px;
|
|
229
|
-
text-align: center;
|
|
230
|
-
padding: 0px 2px;
|
|
231
|
+
// check if there is already a style tag in the head that defined the style for the point label
|
|
232
|
+
// if not, create one
|
|
233
|
+
let styleExists = false;
|
|
234
|
+
document.head.querySelectorAll('style').forEach(style => {
|
|
235
|
+
if (style.textContent?.includes('.point-label')) {
|
|
236
|
+
styleExists = true;
|
|
237
|
+
return;
|
|
231
238
|
}
|
|
232
|
-
|
|
233
|
-
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
if(!styleExists) {
|
|
242
|
+
const style = document.createElement('style');
|
|
243
|
+
style.textContent = `
|
|
244
|
+
.point-label {
|
|
245
|
+
display: flex;
|
|
246
|
+
justify-content: center;
|
|
247
|
+
align-items: center;
|
|
248
|
+
color: white;
|
|
249
|
+
background-color: ${this.#settings.visualization.points.color_1}80;
|
|
250
|
+
border-radius: 5px;
|
|
251
|
+
font-size: 16px;
|
|
252
|
+
text-align: center;
|
|
253
|
+
padding: 0px 2px;
|
|
254
|
+
}
|
|
255
|
+
`;
|
|
256
|
+
document.head.appendChild(style);
|
|
257
|
+
}
|
|
234
258
|
|
|
235
259
|
child.textContent = `[${numberCleaner(positionArray[i])}${this.#settings.general.displayUnit}, ${numberCleaner(positionArray[i + 1])}${this.#settings.general.displayUnit}, ${numberCleaner(positionArray[i + 2])}${this.#settings.general.displayUnit}]`;
|
|
236
260
|
text.appendChild(child);
|
|
@@ -23,7 +23,7 @@ export class GeometryMathManager implements IManager {
|
|
|
23
23
|
|
|
24
24
|
// #endregion Constructors (1)
|
|
25
25
|
|
|
26
|
-
// #region Public Methods (
|
|
26
|
+
// #region Public Methods (9)
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Check which distances of lines to ray
|
|
@@ -102,6 +102,20 @@ export class GeometryMathManager implements IManager {
|
|
|
102
102
|
|
|
103
103
|
public close(): void { }
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Calculate the closest point on a ray to a point
|
|
107
|
+
*
|
|
108
|
+
* @param ray
|
|
109
|
+
* @param point
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
public closestPoint(ray: IRay, point: vec3): vec3 {
|
|
113
|
+
// distance from point to ray
|
|
114
|
+
const dot = vec3.dot(ray.direction, vec3.sub(vec3.create(), point, ray.origin));
|
|
115
|
+
// closest point on ray to point
|
|
116
|
+
return vec3.add(vec3.create(), ray.origin, vec3.multiply(vec3.create(), ray.direction, vec3.fromValues(dot, dot, dot)));
|
|
117
|
+
}
|
|
118
|
+
|
|
105
119
|
/**
|
|
106
120
|
* Calculate the closest point on a line to a point
|
|
107
121
|
*
|
|
@@ -129,6 +143,26 @@ export class GeometryMathManager implements IManager {
|
|
|
129
143
|
return closestPoint;
|
|
130
144
|
}
|
|
131
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Calculate the closest point on a plane to a point
|
|
148
|
+
*
|
|
149
|
+
* @param point
|
|
150
|
+
* @param planeNormal
|
|
151
|
+
* @param planeOrigin
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
public closestPointOnPlane(planeOrigin: vec3, planeNormal: vec3, point: vec3): vec3 {
|
|
155
|
+
// Calculate the vector from the plane origin to the point
|
|
156
|
+
const toPoint = vec3.sub(vec3.create(), point, planeOrigin);
|
|
157
|
+
|
|
158
|
+
// Project the vector onto the plane normal
|
|
159
|
+
const projectionLength = vec3.dot(toPoint, planeNormal);
|
|
160
|
+
const projectionVector = vec3.scale(vec3.create(), planeNormal, projectionLength);
|
|
161
|
+
|
|
162
|
+
// Subtract the projection vector from the original point to get the projected point
|
|
163
|
+
return vec3.sub(vec3.create(), point, projectionVector);
|
|
164
|
+
}
|
|
165
|
+
|
|
132
166
|
/**
|
|
133
167
|
* Calculate the distance between a ray and a line segment
|
|
134
168
|
*
|
|
@@ -251,23 +285,5 @@ export class GeometryMathManager implements IManager {
|
|
|
251
285
|
};
|
|
252
286
|
}
|
|
253
287
|
|
|
254
|
-
// #endregion Public Methods (
|
|
255
|
-
|
|
256
|
-
// #region Private Methods (1)
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Calculate the closest point on a ray to a point
|
|
260
|
-
*
|
|
261
|
-
* @param ray
|
|
262
|
-
* @param point
|
|
263
|
-
* @returns
|
|
264
|
-
*/
|
|
265
|
-
private closestPoint(ray: IRay, point: vec3): vec3 {
|
|
266
|
-
// distance from point to ray
|
|
267
|
-
const dot = vec3.dot(ray.direction, vec3.sub(vec3.create(), point, ray.origin));
|
|
268
|
-
// closest point on ray to point
|
|
269
|
-
return vec3.add(vec3.create(), ray.origin, vec3.multiply(vec3.create(), ray.direction, vec3.fromValues(dot, dot, dot)));
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// #endregion Private Methods (1)
|
|
288
|
+
// #endregion Public Methods (9)
|
|
273
289
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxisRestriction, AxisRestrictionProperties } from './restrictions/axis/AxisRestriction';
|
|
2
1
|
import { DrawingToolsManager } from '../../DrawingToolsManager';
|
|
3
2
|
import { GeometryRestriction, GeometryRestrictionProperties } from './restrictions/geometry/GeometryRestriction';
|
|
4
3
|
import { IManager } from '../../../interfaces/IManager';
|
|
@@ -71,8 +70,6 @@ export class RestrictionManager implements IManager {
|
|
|
71
70
|
restriction = new PlaneRestriction(this.#drawingToolsManager, token, properties as PlaneRestrictionProperties);
|
|
72
71
|
} else if (properties.type === RESTRICTION_TYPE.GEOMETRY) {
|
|
73
72
|
restriction = new GeometryRestriction(this.#drawingToolsManager, token, properties as GeometryRestrictionProperties);
|
|
74
|
-
} else if (properties.type === RESTRICTION_TYPE.AXIS) {
|
|
75
|
-
restriction = new AxisRestriction(this.#drawingToolsManager, token, properties as AxisRestrictionProperties);
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
if (restriction) {
|