@buerli.io/react-cad 0.13.1-beta.4 → 0.13.1-beta.9

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 (39) hide show
  1. package/build/components/UI/CAD/PluginsWindows.d.ts +5 -2
  2. package/build/components/UI/CAD/common/NameEdit.d.ts +1 -3
  3. package/build/components/UI/CAD/hooks/useCurrentInstance.d.ts +1 -1
  4. package/build/components/UI/CAD/hooks/useCurrentProduct.d.ts +1 -1
  5. package/build/components/UI/CAD/hooks/useRoot.d.ts +1 -1
  6. package/build/components/UI/CAD/index.d.ts +1 -0
  7. package/build/components/UI/editors/BooleanEditor/BooleanEditor.d.ts +7 -0
  8. package/build/components/UI/editors/BooleanEditor/useBoolParam.d.ts +2 -0
  9. package/build/components/UI/editors/ExpressionEditor/ExpressionEditor.d.ts +5 -1
  10. package/build/components/UI/editors/ExpressionEditor/useExpressionsParam.d.ts +1 -2
  11. package/build/components/UI/editors/NumberEditor/Mentions.d.ts +11 -0
  12. package/build/components/UI/editors/NumberEditor/NumberEditor.d.ts +10 -0
  13. package/build/components/UI/editors/NumberEditor/useNumParam.d.ts +4 -0
  14. package/build/components/UI/editors/PointEditor/PointEditor.d.ts +9 -1
  15. package/build/components/UI/editors/PointEditor/usePointParam.d.ts +3 -1
  16. package/build/components/UI/editors/RefsEditors/useModes.d.ts +6 -2
  17. package/build/components/UI/editors/TypeEditor/useTypeParam.d.ts +2 -0
  18. package/build/index.cjs.js +17084 -15821
  19. package/build/index.d.ts +4 -1
  20. package/build/index.js +17398 -16138
  21. package/build/plugins/Expressions/useContextMenuItems.d.ts +5 -0
  22. package/build/plugins/Sketch/View/graphics/TmpAngularDimension.d.ts +0 -2
  23. package/build/plugins/Sketch/View/graphics/primitives.d.ts +0 -14
  24. package/build/plugins/Sketch/View/handlers/HandlersConstructors.d.ts +2 -2
  25. package/build/plugins/Sketch/View/handlers/Use.d.ts +3 -0
  26. package/build/plugins/Sketch/View/handlers/filletHelpers.d.ts +5 -7
  27. package/build/plugins/Sketch/View/handlers/splitHelpers.d.ts +13 -28
  28. package/build/plugins/Sketch/types.d.ts +1 -6
  29. package/build/plugins/components/PluginForm.d.ts +12 -0
  30. package/build/utils/helpers.d.ts +1 -23
  31. package/build/utils/mateUtils.d.ts +1 -3
  32. package/build/utils/selection/scopes/mateSelection.d.ts +1 -1
  33. package/build/utils/sketchIntersectionUtils.d.ts +29 -0
  34. package/build/utils/sketchUtils.d.ts +173 -0
  35. package/package.json +8 -11
  36. package/build/plugins/Sketch/View/graphics/RubberBandSelection.d.ts +0 -2
  37. package/build/plugins/Sketch/View/handlers/UseRef.d.ts +0 -3
  38. package/build/plugins/Sketch/utils/getEntities.d.ts +0 -2
  39. package/build/plugins/Sketch/utils/getGeometryPriority.d.ts +0 -2
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import 'antd/dist/antd.css';
3
+ import { DrawingID, ObjectID } from '@buerli.io/core';
4
+ import { MenuElement } from '../../components/UI/CAD/common/ContextMenu';
5
+ export declare function useContextMenuItems(drawingId: DrawingID, productId: ObjectID, setEditName: React.Dispatch<React.SetStateAction<boolean>>): MenuElement[];
@@ -1,7 +1,5 @@
1
1
  import * as THREE from 'three';
2
2
  import React from 'react';
3
- export declare const calcSector: (dimPos: THREE.Vector3, dir0: THREE.Vector3, dir1: THREE.Vector3, center: THREE.Vector3) => 0 | 1 | 2 | 3;
4
- export declare const calcPreviewValue: (dir0: THREE.Vector3, dir1: THREE.Vector3, sector: number, reflex: number) => number;
5
3
  export declare const TmpPositionHandler: React.FC<{
6
4
  position: THREE.Vector3;
7
5
  }>;
@@ -18,20 +18,6 @@ export declare const Point: React.FC<{
18
18
  position: THREE.Vector3;
19
19
  size?: number;
20
20
  } & commonProps>;
21
- export declare function getArcAngles(params: {
22
- start: THREE.Vector3;
23
- end: THREE.Vector3;
24
- center: THREE.Vector3;
25
- clockwise: boolean;
26
- radius: number;
27
- }): {
28
- center: THREE.Vector3;
29
- mid: THREE.Vector3;
30
- radius: number;
31
- startAngle: number;
32
- endAngle: number;
33
- bulge: number;
34
- };
35
21
  export declare const Arc: React.FC<{
36
22
  start: THREE.Vector3;
37
23
  end: THREE.Vector3;
@@ -7,7 +7,6 @@ import { DrawCircle } from './DrawCircle';
7
7
  import { Fillet } from './Fillet';
8
8
  import { Trim } from './Trim';
9
9
  import { Split } from './Split';
10
- import { UseRef } from './UseRef';
11
10
  import { SSelect } from './SSelect';
12
11
  export declare const HandlersConstructors: {
13
12
  createAngle: typeof CreateAngle;
@@ -19,7 +18,8 @@ export declare const HandlersConstructors: {
19
18
  fillet: typeof Fillet;
20
19
  trim: typeof Trim;
21
20
  split: typeof Split;
22
- useReference: typeof UseRef;
21
+ useGeometry: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
22
+ useReference: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
23
23
  drawRect2Points: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
24
24
  drawRectCenter: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
25
25
  drawArcCenter: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
@@ -0,0 +1,3 @@
1
+ import { DrawingID, PluginID } from '@buerli.io/core';
2
+ import { HandlersList, Handler } from '../../types';
3
+ export declare function Use(drawingId: DrawingID, pluginId: PluginID, useType: HandlersList.USEGEOM | HandlersList.USEREF): Handler;
@@ -1,8 +1,6 @@
1
1
  import * as THREE from 'three';
2
- import { IStructureTree, ObjectID, IStructureObject } from '@buerli.io/core';
3
- export declare function getSketchDescendants(tree: IStructureTree, sketchId: ObjectID): number[];
4
- export declare function findPointsAt(pos: THREE.Vector3, tree: IStructureTree, sketchId: ObjectID): IStructureObject[];
5
- export declare function findConstraints(type: string, objA: IStructureObject, objB: IStructureObject, tree: IStructureTree, sketchId: ObjectID): number[];
2
+ import { ObjectID, IStructureObject, DrawingID } from '@buerli.io/core';
3
+ export declare function findPointsAt(drawingId: DrawingID, sketchId: ObjectID, pos: THREE.Vector3): import("@buerli.io/core").ScgObject[];
6
4
  declare type FilletInfo = {
7
5
  lines: Array<IStructureObject>;
8
6
  lineStarts: Array<IStructureObject>;
@@ -17,7 +15,7 @@ declare type ExistingFilletInfo = FilletInfo & {
17
15
  objectEnds: IStructureObject[];
18
16
  filletPoint: IStructureObject;
19
17
  };
20
- export declare function recognizeFilletableAngle(pos: THREE.Vector3, tree: IStructureTree, sketchId: ObjectID): NewFilletInfo | null;
18
+ export declare function recognizeFilletableAngle(drawingId: DrawingID, sketchId: ObjectID, pos: THREE.Vector3): NewFilletInfo | null;
21
19
  export declare function getTouchPoints(info: FilletInfo, distance: number): THREE.Vector3[] | null;
22
20
  export declare function calculateCenterPoint(start: THREE.Vector3, end: THREE.Vector3, control: THREE.Vector3): THREE.Vector3;
23
21
  export declare function evaluateClockwise(start: THREE.Vector3, end: THREE.Vector3, control: THREE.Vector3): boolean;
@@ -28,7 +26,7 @@ export declare function calculateFilletParams(info: FilletInfo, distance: number
28
26
  clockwise: boolean;
29
27
  control: THREE.Vector3;
30
28
  } | null;
31
- export declare function calculateNewFilletData(object: IStructureObject, tree: IStructureTree, sketchId: ObjectID): {
29
+ export declare function calculateNewFilletData(drawingId: DrawingID, sketchId: ObjectID, object: IStructureObject): {
32
30
  info: NewFilletInfo;
33
31
  params: {
34
32
  start: THREE.Vector3;
@@ -38,5 +36,5 @@ export declare function calculateNewFilletData(object: IStructureObject, tree: I
38
36
  control: THREE.Vector3;
39
37
  };
40
38
  } | null;
41
- export declare function recognizeFilletByArc(object: IStructureObject, tree: IStructureTree, sketchId: ObjectID): ExistingFilletInfo | null;
39
+ export declare function recognizeFilletByArc(drawingId: DrawingID, sketchId: ObjectID, object: IStructureObject): ExistingFilletInfo | null;
42
40
  export {};
@@ -1,34 +1,19 @@
1
1
  import * as THREE from 'three';
2
- import { DrawingID, ObjectID } from "@buerli.io/core";
3
- import { CCClasses } from "@buerli.io/classcad";
2
+ import { DrawingID, ObjectID } from '@buerli.io/core';
3
+ import { CCClasses } from '@buerli.io/classcad';
4
+ import { CCArcInfo, CCCircleInfo, CCLineInfo } from '../../../../utils/sketchIntersectionUtils';
4
5
  declare type CommonInfo = {
5
6
  class: CCClasses.CCLine | CCClasses.CCArc | CCClasses.CCCircle;
6
7
  bb: THREE.Box2;
8
+ isSplittable: boolean;
7
9
  };
8
- declare type LineInfo = CommonInfo & {
9
- start: THREE.Vector3;
10
- end: THREE.Vector3;
11
- dir: THREE.Vector3;
12
- };
13
- declare type ArcInfo = CommonInfo & {
14
- start: THREE.Vector3;
15
- end: THREE.Vector3;
16
- center: THREE.Vector3;
17
- radius: number;
18
- clockwise: boolean;
19
- startAngle: number;
20
- endAngle: number;
21
- angularlength: number;
22
- };
23
- declare type CircleInfo = CommonInfo & {
24
- center: THREE.Vector3;
25
- radius: number;
26
- };
27
- export declare type ObjInfo = LineInfo | ArcInfo | CircleInfo;
28
- export declare function getSketchObjInfo(drawingId: DrawingID, objId: ObjectID): LineInfo | CircleInfo | undefined;
29
- export declare function getNormalizedPosition(point: THREE.Vector3, sketchObject: ObjInfo): number;
30
- export declare function getParameterizedPosition(t: number, sketchObject: ObjInfo): THREE.Vector3;
31
- export declare function calculateIntersections(object: ObjInfo, sketchObjects: ObjInfo[]): number[];
32
- export declare function calculateClosestIntersection(point: THREE.Vector3, object1: ObjInfo, object2: ObjInfo): number[][];
33
- export declare function getClosestPoint(point: THREE.Vector3, sketchObject: ObjInfo): THREE.Vector3;
10
+ declare type CCLineInfoE = CommonInfo & CCLineInfo;
11
+ declare type CCArcInfoE = CommonInfo & CCArcInfo;
12
+ declare type CCCircleInfoE = CommonInfo & CCCircleInfo;
13
+ export declare type SketchObjInfoE = CCLineInfoE | CCArcInfoE | CCCircleInfoE;
14
+ export declare function getSketchObjInfo(drawingId: DrawingID, objId: ObjectID, unsplittableIds: ObjectID[]): CCLineInfoE | CCCircleInfoE | undefined;
15
+ export declare function getRigidsetEntityIds(drawingId: DrawingID, sketchId: ObjectID): number[];
16
+ export declare function calculateIntersections(object: SketchObjInfoE, sketchObjects: SketchObjInfoE[]): number[];
17
+ export declare function calculateClosestIntersection(point: THREE.Vector3, object1: SketchObjInfoE, object2: SketchObjInfoE): number[][];
18
+ export declare function getClosestPoint(point: THREE.Vector3, sketchObject: SketchObjInfoE): THREE.Vector3;
34
19
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ThreeEvent, ReactThreeFiber } from '@react-three/fiber';
3
2
  import { IStructureObject, ObjectID } from '@buerli.io/core';
4
3
  import { InfinityPlane } from '../../components/graphics/InfinityPlane';
@@ -36,11 +35,6 @@ export declare type SketchPState = {
36
35
  scale: number;
37
36
  step: number;
38
37
  mousePos: THREE.Vector3 | undefined;
39
- drawnObjectsRef: React.MutableRefObject<THREE.Group> | undefined;
40
- rubberBandRectangle: {
41
- min: THREE.Vector2;
42
- max: THREE.Vector2;
43
- } | undefined;
44
38
  cursor: null | string;
45
39
  needsUpdate: number;
46
40
  };
@@ -60,6 +54,7 @@ export declare enum HandlersList {
60
54
  HOVER = "hover",
61
55
  TRIM = "trim",
62
56
  SPLIT = "split",
57
+ USEGEOM = "useGeometry",
63
58
  USEREF = "useReference",
64
59
  SSELECT = "sSelect"
65
60
  }
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { DrawingID, PluginID } from '@buerli.io/core';
3
+ import { FacadeReturn } from '@buerli.io/classcad';
3
4
  import { MemberParam } from '../../types';
4
5
  /**
6
+ * @deprecated
5
7
  * @param drawingId - id of the drawing.
6
8
  * @param update - a function which will be called when user presses "Update" button.
7
9
  * @param params - all params which should be sent to the server. PluginForm validates each of them.
@@ -22,3 +24,13 @@ export declare const PluginForm: React.FC<{
22
24
  autoClose?: boolean;
23
25
  forceUpdateEnabled?: boolean;
24
26
  }>;
27
+ export declare const PluginForm_v1: React.FC<{
28
+ drawingId: DrawingID;
29
+ pluginId: PluginID;
30
+ update: () => Promise<FacadeReturn>;
31
+ params: Record<string, MemberParam<any>>;
32
+ children?: React.ReactNode;
33
+ validator?: () => string[];
34
+ autoClose?: boolean;
35
+ forceUpdateEnabled?: boolean;
36
+ }>;
@@ -1,40 +1,18 @@
1
- import { CCClasses } from '@buerli.io/classcad';
2
- import { DrawingID, GeometryElement, GraphicID, IStructureObject, IStructureTree, MemberType, ObjectID, PointMem, PointMemValue, SelectedItem, ContainerGeometryT } from '@buerli.io/core';
1
+ import { DrawingID, GeometryElement, GraphicID, IStructureObject, MemberType, ObjectID, PointMem, PointMemValue, ContainerGeometryT } from '@buerli.io/core';
3
2
  import * as THREE from 'three';
4
- export declare function membersValues(drawingId: DrawingID, ccObjId: DrawingID): any;
5
- export declare function addMembers(drawingId: DrawingID, ccObjId: DrawingID): {
6
- members?: undefined;
7
- } | {
8
- members: any;
9
- };
10
3
  export declare function useGlobalToLocalMatrix(drawingId: DrawingID, objId: ObjectID | undefined): THREE.Matrix4;
11
4
  export declare function getGlobalToLocalMatrix(drawingId: DrawingID, objId: ObjectID): THREE.Matrix4;
12
- export declare function setReference(index: number, state: any, set: any): (selected: SelectedItem[]) => void;
13
5
  export declare function convertToVector(point: PointMem | undefined): THREE.Vector3;
14
6
  export declare function convertToArray(point: PointMem): number[];
15
7
  export declare function linesIntersection(point1: THREE.Vector3, dir1: THREE.Vector3, point2: THREE.Vector3, dir2: THREE.Vector3): THREE.Vector3 | null;
16
8
  export declare const angleVecVec: (a: THREE.Vector3, b: THREE.Vector3) => number;
17
- export declare const calculateTangent: (tree: IStructureTree, object: IStructureObject, point: THREE.Vector3) => THREE.Vector3 | undefined;
18
- export declare function getDescendants(tree: IStructureTree, objectId: ObjectID): number[];
19
- export declare function getAncestorIdByClass(drawingId: DrawingID, objectId: ObjectID, parentClass: CCClasses): number | null;
20
- export declare const isSketchGeometry: (arg: IStructureObject | CCClasses) => boolean;
21
- export declare const is2DConstraint: (arg: IStructureObject | CCClasses) => boolean;
22
- export declare const isSketchRegion: (arg: IStructureObject | CCClasses) => boolean;
23
- export declare const isSketchObj: (obj: IStructureObject) => boolean;
24
9
  export declare const degreesToRadians: (degrees: number) => number;
25
10
  export declare const radiansToDegrees: (radians: number) => number;
26
11
  export declare const getPointOnPlane: (unprojectedPoint: THREE.Vector3, camera: THREE.Camera, globalToLocalM: THREE.Matrix4) => THREE.Vector3;
27
12
  export declare const closestAngle: (value: number, to: number) => number;
28
13
  export declare const stringifyValue: (value: string | number | PointMemValue, type: MemberType) => string;
29
14
  export declare function findObject(drawingId: DrawingID, id: GraphicID | ObjectID, unrollRefs?: boolean): IStructureObject | ContainerGeometryT | GeometryElement | undefined;
30
- export declare function round(value: number, digits: number): number;
31
- export declare function rgbToHex(color: {
32
- r: number;
33
- g: number;
34
- b: number;
35
- }): string;
36
15
  export declare function fmod(num: number, denom: number): number;
37
- export declare function numberToHexColor(color: number): string;
38
16
  export declare const solveQuadratic: (a: number, b: number, c: number) => number[];
39
17
  export declare const solveQuartic: (a: number, b: number, c: number, d: number, e: number) => number[];
40
18
  export declare function getRegionCoordSys(drawingId: DrawingID, regionObj: IStructureObject): THREE.Vector3[];
@@ -1,4 +1,2 @@
1
1
  import { DrawingID, ObjectID } from '@buerli.io/core';
2
- export declare const getAncestors: (drawingId: DrawingID, objectId: ObjectID) => number[];
3
- export declare const getActiveReference: (drawingId: DrawingID, matePath: ObjectID[], activeRefs: ObjectID[]) => number | undefined;
4
- export declare const getProductRigidSet: (drawingId: DrawingID, productId: ObjectID, rigidSets: ObjectID[]) => number | undefined;
2
+ export declare const getProductRigidSet: (drawingId: DrawingID, instanceId: ObjectID, rigidSets: ObjectID[]) => number | undefined;
@@ -15,7 +15,7 @@ export declare const createMateItem: (matePath: ObjectID[], csys: IStructureObje
15
15
  scope: string;
16
16
  data: {
17
17
  matePath: number[];
18
- csys: IStructureObject;
18
+ csys: import("@buerli.io/core").ScgObject;
19
19
  flip: FlipType;
20
20
  reoriented: ReorientedType;
21
21
  };
@@ -0,0 +1,29 @@
1
+ import * as THREE from 'three';
2
+ export declare type CCLineInfo = {
3
+ start: THREE.Vector3;
4
+ end: THREE.Vector3;
5
+ dir: THREE.Vector3;
6
+ };
7
+ export declare type CCArcInfo = {
8
+ start: THREE.Vector3;
9
+ end: THREE.Vector3;
10
+ center: THREE.Vector3;
11
+ radius: number;
12
+ clockwise: boolean;
13
+ startAngle: number;
14
+ endAngle: number;
15
+ angularLength: number;
16
+ };
17
+ export declare type CCCircleInfo = {
18
+ center: THREE.Vector3;
19
+ radius: number;
20
+ };
21
+ export declare type SketchObjInfo = CCLineInfo | CCArcInfo | CCCircleInfo;
22
+ export declare function getNormalizedPosition(point: THREE.Vector3, sketchObject: SketchObjInfo): number;
23
+ export declare function getParameterizedPosition(t: number, sketchObject: SketchObjInfo): THREE.Vector3;
24
+ export declare function intersectLineLine(line1: CCLineInfo, line2: CCLineInfo): number[][];
25
+ export declare function intersectLineCircle(line: CCLineInfo, circle: CCCircleInfo | CCArcInfo): number[][];
26
+ export declare function intersectLineArc(line: CCLineInfo, arc: CCArcInfo): number[][];
27
+ export declare function intersectCircleCircle(circle1: CCCircleInfo | CCArcInfo, circle2: CCCircleInfo | CCArcInfo): number[][];
28
+ export declare function intersectArcArc(arc1: CCArcInfo, arc2: CCArcInfo): number[][];
29
+ export declare function intersectArcCircle(arc: CCArcInfo, circle: CCCircleInfo): number[][];
@@ -0,0 +1,173 @@
1
+ import * as THREE from 'three';
2
+ import { CCClasses } from '@buerli.io/classcad';
3
+ import { ArrayMem, DrawingID, IStructureObject, ObjectID } from '@buerli.io/core';
4
+ /**
5
+ * Checks if the currently active plugin is CC_Sketch.
6
+ *
7
+ * @param drawingId The drawing id.
8
+ * @returns True if CC_Sketch is active, false otherwise.
9
+ */
10
+ export declare const isSketchActive: (drawingId: DrawingID) => boolean;
11
+ /**
12
+ * Calculates the tangent vector of a CC_Line / CC_Arc / CC_Circle at the specified point.
13
+ *
14
+ * @param drawingId The drawing id.
15
+ * @param curveId Id of a CC_Line / CC_Arc / CC_Circle.
16
+ * @param point Point at which the tangent touches a curve.
17
+ * @returns Tangent vector value.
18
+ */
19
+ export declare const calculateTangent: (drawingId: DrawingID, curveId: ObjectID, point: THREE.Vector3) => THREE.Vector3 | undefined;
20
+ /**
21
+ * Checks if the object represents a sketch geometry.
22
+ *
23
+ * @param arg A structure object or CCClass of a structure object.
24
+ * @returns True if the object represents a sketch geometry, false otherwise.
25
+ */
26
+ export declare const isSketchGeometry: (arg: IStructureObject | CCClasses) => boolean;
27
+ /**
28
+ * Checks if the object represents a 2d constraint.
29
+ *
30
+ * @param arg A structure object or CCClass of a structure object.
31
+ * @returns True if the object represents a 2d constraint, false otherwise.
32
+ */
33
+ export declare const is2DConstraint: (arg: IStructureObject | CCClasses) => boolean;
34
+ /**
35
+ * Checks if the object represents a sketch geometry or 2d constraint or a sketch itself.
36
+ *
37
+ * @param arg A structure object or CCClass of a structure object.
38
+ * @returns True if the object represents a sketch or a sketch geometry or a 2d constraint, false otherwise.
39
+ */
40
+ export declare const isSketchObj: (arg: IStructureObject | CCClasses) => boolean;
41
+ /**
42
+ * Checks if the object represents a sketch region.
43
+ *
44
+ * @param arg A structure object or CCClass of a structure object.
45
+ * @returns True if the object represents a sketch region, false otherwise.
46
+ */
47
+ export declare const isSketchRegion: (arg: IStructureObject | CCClasses) => boolean;
48
+ /**
49
+ * Searches for the sketch which nests the specified object.
50
+ *
51
+ * @param drawingId The drawing id.
52
+ * @param objId Id of an object which (supposedly) is nested within some sketch.
53
+ * @returns Id of the sketch which nests the specified object, or -1 if it wasn't found.
54
+ */
55
+ export declare const getSketchId: (drawingId: DrawingID, objId: ObjectID | undefined) => number;
56
+ /**
57
+ * Takes ids of 2 CC_Points and if they belong to the same line, returns the id of that line; otherwise, returns ids of these points.
58
+ *
59
+ * @param drawingId The drawing id.
60
+ * @param id1 Id of the first CC_Point.
61
+ * @param id2 Id of the seconds CC_Point.
62
+ * @returns An array with a single id of the CC_Line if both points belong to the same one, or an array [id1, id2] otherwise.
63
+ */
64
+ export declare const rollUpPoints: (drawingId: DrawingID, id1: ObjectID, id2: ObjectID) => number[];
65
+ /**
66
+ * Looks up for entities of a 2d constraint / sketch region.
67
+ *
68
+ * @param drawingId The drawing id.
69
+ * @param objectId Id of a 2d constraint / sketch region.
70
+ * @returns Ids of geometry entities linked to the specified 2d constraint / sketch region.
71
+ */
72
+ export declare const getEntities: (drawingId: DrawingID, objectId: ObjectID) => number[];
73
+ /**
74
+ * Defines a numeric priority of sketch objects and regions, which may be used for sorting them or as a polygon offset for rendering.
75
+ *
76
+ * @param arg A structure object or CCClass of a structure object.
77
+ * @returns A number value (1-5) which represents the sketch object's priority, or -1 if arg is not a sketch object.
78
+ */
79
+ export declare const getSketchPriority: (arg: IStructureObject | CCClasses) => 1 | 2 | 4 | 3 | -1 | 5;
80
+ /**
81
+ * Projects a point onto the specified sketch geometry.
82
+ *
83
+ * @param drawingId The drawing id.
84
+ * @param geometryId Id of a sketch geometry.
85
+ * @param point A point to be projected.
86
+ * @returns A projected point.
87
+ */
88
+ export declare const projectPointOnGeometry: (drawingId: DrawingID, geometryId: ObjectID, point: THREE.Vector3) => THREE.Vector3;
89
+ /**
90
+ * Calculates an object's center point.
91
+ *
92
+ * @param drawingId The drawing id.
93
+ * @param geometryId Id of a sketch geometry.
94
+ * @returns A center point of specified sketch geometry.
95
+ */
96
+ export declare const getObjCenterPoint: (drawingId: DrawingID, geometryId: ObjectID) => THREE.Vector3;
97
+ /**
98
+ * Calculates arc midpoint, radius, startAngle, endAngle and bulge values.
99
+ *
100
+ * @param start Start point of an arc.
101
+ * @param end End point of an arc.
102
+ * @param center Center point of an arc.
103
+ * @param clockwise True if the direction from start to end is clockwise, false otherwise.
104
+ * @returns An object with center, mid, radius, startAngle, endAngle and bulge values.
105
+ */
106
+ export declare const getArcInfo: (start: THREE.Vector3, end: THREE.Vector3, center: THREE.Vector3, clockwise: boolean) => {
107
+ center: THREE.Vector3;
108
+ mid: THREE.Vector3;
109
+ radius: number;
110
+ startAngle: number;
111
+ endAngle: number;
112
+ bulge: number;
113
+ };
114
+ /**
115
+ * Finds the sector (indexed 0-3) to which the dimPos belongs to. Sectors are divided by dir0 and dir1 vectors and their negations.
116
+ *
117
+ * @param dimPos A point
118
+ * @param dir0 The first direction.
119
+ * @param dir1 The second direction.
120
+ * @param center A center point of the arc.
121
+ * @returns A sector index (0-3) to which the dimPos belongs to.
122
+ */
123
+ export declare const getArcSector: (dimPos: THREE.Vector3, dir0: THREE.Vector3, dir1: THREE.Vector3, center: THREE.Vector3) => 0 | 1 | 2 | 3;
124
+ /**
125
+ * Calculates the angle between dir0 and dir1 or their negations depending on sector and reflex values.
126
+ *
127
+ * @param dir0 The first direction.
128
+ * @param dir1 The second direction.
129
+ * @param sector The sector index (0-3).
130
+ * @param reflex A flag for changing angle coverage from the current sector to the opposite 3.
131
+ * @returns The resulting angle between dir0 and dir1.
132
+ */
133
+ export declare const getArcPreviewValue: (dir0: THREE.Vector3, dir1: THREE.Vector3, sector: number, reflex: number) => number;
134
+ /**
135
+ * Looks up for sketch's bounds values.
136
+ *
137
+ * @param boundsMember The sketch.boundingBox member.
138
+ * @returns An object containing the center, radius and box values.
139
+ */
140
+ export declare const getSketchBounds: (boundsMember: ArrayMem) => {
141
+ center: THREE.Vector3;
142
+ radius: number;
143
+ box: THREE.Box3;
144
+ };
145
+ /**
146
+ * Calculates the global bounding box, camera position, camera target and camera up vector to fit the camera for the given sketch.
147
+ *
148
+ * @param drawingId The drawing id.
149
+ * @param sketchId Id of the sketch.
150
+ * @param radiusMultiplier A multiplier for the distance between camera and sketch.
151
+ * @returns An object with globBox, position, target and up values.
152
+ */
153
+ export declare const getSketchFitInfo: (drawingId: DrawingID, sketchId: ObjectID, radiusMultiplier?: number) => {
154
+ globBox: THREE.Box3;
155
+ position: THREE.Vector3;
156
+ target: THREE.Vector3;
157
+ up: THREE.Vector3;
158
+ } | undefined;
159
+ /**
160
+ * Calculates the global bounding box, camera position, camera target and camera up vector for the given sketch to target some point with camera oriented orthogonally to it.
161
+ *
162
+ * @param drawingId The drawing id.
163
+ * @param sketchId Id of the sketch.
164
+ * @param targetPos A point near the sketch plane to use as the camera target.
165
+ * @param distance The distance value to set between camera and sketch.
166
+ * @returns An object with globBox, position, target and up values.
167
+ */
168
+ export declare const getSketchNormalViewInfo: (drawingId: DrawingID, sketchId: ObjectID, targetPos: THREE.Vector3, distance: number) => {
169
+ globBox: THREE.Box3;
170
+ position: THREE.Vector3;
171
+ target: THREE.Vector3;
172
+ up: THREE.Vector3;
173
+ } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/react-cad",
3
- "version": "0.13.1-beta.4",
3
+ "version": "0.13.1-beta.9",
4
4
  "description": "buerli CAD components",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "repository": {},
@@ -19,11 +19,6 @@
19
19
  "lint": "eslint \"./src/**/*.ts?(x)\"",
20
20
  "prettify": "prettier --write \"./{src,tests}/**/*.{js,jsx,ts,tsx,json}\""
21
21
  },
22
- "husky": {
23
- "hooks": {
24
- "pre-commit": "lint-staged"
25
- }
26
- },
27
22
  "lint-staged": {
28
23
  "*.{js,jsx,ts,tsx,json,md}": [
29
24
  "prettier --write",
@@ -37,7 +32,7 @@
37
32
  "@babel/preset-env": "^7.15.0",
38
33
  "@babel/preset-react": "^7.14.5",
39
34
  "@babel/preset-typescript": "^7.10.4",
40
- "@buerli.io/icons": "^1.0.16",
35
+ "@buerli.io/icons": "^1.0.18",
41
36
  "@react-three/drei": "9.92.3",
42
37
  "@react-three/fiber": "8.15.14",
43
38
  "@rollup/plugin-babel": "^5.3.0",
@@ -45,6 +40,7 @@
45
40
  "@rollup/plugin-node-resolve": "^13.0.4",
46
41
  "@testing-library/jest-dom": "^5.11.5",
47
42
  "@testing-library/react": "^13.4.0",
43
+ "@testing-library/user-event": "^14.6.1",
48
44
  "@types/jest": "^29.1.2",
49
45
  "@types/node": "^11.13.8",
50
46
  "@types/path-browserify": "^1.0.0",
@@ -87,17 +83,18 @@
87
83
  "peerDependencies": {
88
84
  "@react-three/drei": ">=9.92.3",
89
85
  "@react-three/fiber": ">=8.15.14",
90
- "three": ">=0.153",
91
- "react": ">=18.0"
86
+ "react": ">=18.0",
87
+ "three": ">=0.153"
92
88
  },
93
89
  "dependencies": {
94
- "@buerli.io/classcad": "0.13.1-beta.4",
95
- "@buerli.io/react": "0.13.1-beta.4",
90
+ "@buerli.io/classcad": "0.13.1-beta.9",
91
+ "@buerli.io/react": "0.13.1-beta.9",
96
92
  "@dnd-kit/core": "^6.0.8",
97
93
  "@dnd-kit/modifiers": "^6.0.1",
98
94
  "@dnd-kit/sortable": "^7.0.2",
99
95
  "@react-three/postprocessing": "2.15.0",
100
96
  "antd": "^4.23.4",
97
+ "dompurify": "^3.2.6",
101
98
  "path-browserify": "^1.0.1",
102
99
  "postprocessing": "6.33.0",
103
100
  "react-colorful": "^5.3.0",
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const RubberBandRectangle: React.FC;
@@ -1,3 +0,0 @@
1
- import { DrawingID, PluginID } from '@buerli.io/core';
2
- import { Handler } from '../../types';
3
- export declare function UseRef(drawingId: DrawingID, pluginId: PluginID): Handler;
@@ -1,2 +0,0 @@
1
- import { DrawingID, ObjectID } from '@buerli.io/core';
2
- export declare const getEntities: (drawingId: DrawingID, objectId: ObjectID) => number[];
@@ -1,2 +0,0 @@
1
- import { IStructureObject } from '@buerli.io/core';
2
- export declare function getGeometryPriority(object: IStructureObject): 1 | 2 | 4 | 3 | -1 | 5;