@soonspacejs/plugin-measuring 2.13.10 → 2.13.11

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/index.d.ts CHANGED
@@ -1,117 +1,117 @@
1
- import SoonSpace, { PoiNode } from 'soonspacejs';
2
- import { BufferGeometry, Camera, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Object3D, Scene, Sprite, SpriteMaterial, Vector3 } from 'three';
3
- import { Options } from './utils/ProjectSettingsDef';
4
- export declare enum MeasuringMode {
5
- Distance = "Distance",
6
- Area = "Area",
7
- Angle = "Angle"
8
- }
9
- /**
10
- * MeasuringPlugin
11
- */
12
- declare class MeasuringPlugin {
13
- readonly ssp: SoonSpace;
14
- static LINE_MATERIAL: LineBasicMaterial;
15
- static MESH_MATERIAL: MeshBasicMaterial;
16
- static MAX_DISTANCE: number;
17
- static OBJ_NAME: string;
18
- static LABEL_NAME: string;
19
- mode: MeasuringMode | null;
20
- protected options: Required<Options>;
21
- protected scene: Scene;
22
- protected camera: Camera;
23
- protected spriteMaterial?: SpriteMaterial;
24
- objectsStore: Set<Object3D<import("three").Object3DEventMap>>;
25
- onCancel: () => void;
26
- onDone: () => void;
27
- protected pointMarkers: Sprite[];
28
- protected polyline?: Line;
29
- protected faces?: Mesh;
30
- protected curve?: Line;
31
- protected labels: PoiNode[];
32
- protected pointArray: Vector3[];
33
- protected tempPointMarker?: Sprite;
34
- protected tempLine?: Line;
35
- protected tempLabel?: PoiNode;
36
- protected lastClickTime?: number;
37
- constructor(ssp: SoonSpace);
38
- get domElement(): HTMLDivElement;
39
- /**
40
- * Starts the measurement
41
- */
42
- start(mode?: MeasuringMode, options?: Options): void;
43
- /**
44
- * Ends the measurement
45
- */
46
- close(): void;
47
- cancel(): void;
48
- clear(): void;
49
- /**
50
- * Initializes point marker material
51
- */
52
- initPointMarkerMaterial(): void;
53
- /**
54
- * Creates point marker
55
- */
56
- private createPointMarker;
57
- /**
58
- * Creates Line
59
- */
60
- private createLine;
61
- /**
62
- * Creates Mesh
63
- */
64
- private createFaces;
65
- /**
66
- * Draw completed
67
- */
68
- done(): void;
69
- mousemove: (e: MouseEvent) => void;
70
- dblclick: (e: MouseEvent) => void;
71
- click: (e: MouseEvent) => void;
72
- keydown: (e: KeyboardEvent) => void;
73
- /**
74
- * The the closest intersection
75
- * @param e
76
- */
77
- getClosestIntersection: (e: MouseEvent) => Vector3 | null | undefined;
78
- /**
79
- * Adds or update temp label and position
80
- */
81
- addOrUpdateTempLabel(label: string, position: Vector3): void;
82
- /**
83
- * Creates label
84
- */
85
- createLabel(text: string): PoiNode;
86
- /**
87
- * Creates the arc curve to indicate the angle in degree
88
- */
89
- createCurve(p0: Vector3, p1: Vector3, p2: Vector3): Line<BufferGeometry<import("three").NormalBufferAttributes>, LineBasicMaterial, import("three").Object3DEventMap>;
90
- /**
91
- * Calculates area
92
- * TODO: for concave polygon, the value doesn't right, need to fix it
93
- * @param points
94
- */
95
- calculateArea(points: Vector3[]): number;
96
- /**
97
- * Gets included angle of two lines in degree
98
- */
99
- calculateAngle(startPoint: Vector3, middlePoint: Vector3, endPoint: Vector3): number;
100
- /**
101
- * Gets angle bisector of two lines
102
- */
103
- getAngleBisector(startPoint: Vector3, middlePoint: Vector3, endPoint: Vector3): Vector3;
104
- /**
105
- * Get the barycenter of points
106
- */
107
- getBarycenter(points: Vector3[]): Vector3;
108
- /**
109
- * Gets unit string for distance, area or angle
110
- */
111
- getUnitString(): string;
112
- /**
113
- * Converts a number to a string with proper fraction digits
114
- */
115
- numberToString(num: number): string;
116
- }
117
- export default MeasuringPlugin;
1
+ import SoonSpace, { PoiNode } from 'soonspacejs';
2
+ import { BufferGeometry, Camera, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Object3D, Scene, Sprite, SpriteMaterial, Vector3 } from 'three';
3
+ import { Options } from './utils/ProjectSettingsDef';
4
+ export declare enum MeasuringMode {
5
+ Distance = "Distance",
6
+ Area = "Area",
7
+ Angle = "Angle"
8
+ }
9
+ /**
10
+ * MeasuringPlugin
11
+ */
12
+ declare class MeasuringPlugin {
13
+ readonly ssp: SoonSpace;
14
+ static LINE_MATERIAL: LineBasicMaterial;
15
+ static MESH_MATERIAL: MeshBasicMaterial;
16
+ static MAX_DISTANCE: number;
17
+ static OBJ_NAME: string;
18
+ static LABEL_NAME: string;
19
+ mode: MeasuringMode | null;
20
+ protected options: Required<Options>;
21
+ protected scene: Scene;
22
+ protected camera: Camera;
23
+ protected spriteMaterial?: SpriteMaterial;
24
+ objectsStore: Set<Object3D<import("three").Object3DEventMap>>;
25
+ onCancel: () => void;
26
+ onDone: () => void;
27
+ protected pointMarkers: Sprite[];
28
+ protected polyline?: Line;
29
+ protected faces?: Mesh;
30
+ protected curve?: Line;
31
+ protected labels: PoiNode[];
32
+ protected pointArray: Vector3[];
33
+ protected tempPointMarker?: Sprite;
34
+ protected tempLine?: Line;
35
+ protected tempLabel?: PoiNode;
36
+ protected lastClickTime?: number;
37
+ constructor(ssp: SoonSpace);
38
+ get domElement(): HTMLDivElement;
39
+ /**
40
+ * Starts the measurement
41
+ */
42
+ start(mode?: MeasuringMode, options?: Options): void;
43
+ /**
44
+ * Ends the measurement
45
+ */
46
+ close(): void;
47
+ cancel(): void;
48
+ clear(): void;
49
+ /**
50
+ * Initializes point marker material
51
+ */
52
+ initPointMarkerMaterial(): void;
53
+ /**
54
+ * Creates point marker
55
+ */
56
+ private createPointMarker;
57
+ /**
58
+ * Creates Line
59
+ */
60
+ private createLine;
61
+ /**
62
+ * Creates Mesh
63
+ */
64
+ private createFaces;
65
+ /**
66
+ * Draw completed
67
+ */
68
+ done(): void;
69
+ mousemove: (e: MouseEvent) => void;
70
+ dblclick: (e: MouseEvent) => void;
71
+ click: (e: MouseEvent) => void;
72
+ keydown: (e: KeyboardEvent) => void;
73
+ /**
74
+ * The the closest intersection
75
+ * @param e
76
+ */
77
+ getClosestIntersection: (e: MouseEvent) => Vector3 | null | undefined;
78
+ /**
79
+ * Adds or update temp label and position
80
+ */
81
+ addOrUpdateTempLabel(label: string, position: Vector3): void;
82
+ /**
83
+ * Creates label
84
+ */
85
+ createLabel(text: string): PoiNode;
86
+ /**
87
+ * Creates the arc curve to indicate the angle in degree
88
+ */
89
+ createCurve(p0: Vector3, p1: Vector3, p2: Vector3): Line<BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, LineBasicMaterial, import("three").Object3DEventMap>;
90
+ /**
91
+ * Calculates area
92
+ * TODO: for concave polygon, the value doesn't right, need to fix it
93
+ * @param points
94
+ */
95
+ calculateArea(points: Vector3[]): number;
96
+ /**
97
+ * Gets included angle of two lines in degree
98
+ */
99
+ calculateAngle(startPoint: Vector3, middlePoint: Vector3, endPoint: Vector3): number;
100
+ /**
101
+ * Gets angle bisector of two lines
102
+ */
103
+ getAngleBisector(startPoint: Vector3, middlePoint: Vector3, endPoint: Vector3): Vector3;
104
+ /**
105
+ * Get the barycenter of points
106
+ */
107
+ getBarycenter(points: Vector3[]): Vector3;
108
+ /**
109
+ * Gets unit string for distance, area or angle
110
+ */
111
+ getUnitString(): string;
112
+ /**
113
+ * Converts a number to a string with proper fraction digits
114
+ */
115
+ numberToString(num: number): string;
116
+ }
117
+ export default MeasuringPlugin;
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import t from"soonspacejs";import{LineBasicMaterial as e,DoubleSide as s,MeshBasicMaterial as i,Vector3 as n,SpriteMaterial as r,Sprite as o,BufferGeometry as h,Line as a,Mesh as l,QuadraticBezierCurve3 as c}from"three";const p={m:1,mm:.001,cm:.01,ft:.3048,in:.0254,pt:function(){const t=document.createElement("div");return t.setAttribute("style","height: 1in; visibility: hidden; position: absolute; margin: 0; padding: 0;"),document.body.appendChild(t),.0254/t.clientHeight}()},d=t=>2===t?"²":3===t?"³":"",m=(t,e=1)=>t+d(e),A=(t,e,s,i=1)=>{if(null==s&&(s=e),s===e)return{value:t,unit:m(s)};return{value:t*Math.pow(p[e]/p[s],i),unit:m(s)+d(i)}},u=(t,e)=>t.toFixed(e);var y;!function(t){t.Distance="Distance",t.Area="Area",t.Angle="Angle"}(y||(y={}));const{utils:{randomString:f}}=t;class b{constructor(t){this.ssp=t,this.mode=null,this.options={unit:"m",precision:2},this.objectsStore=new Set,this.onCancel=()=>{},this.onDone=()=>{},this.pointMarkers=[],this.labels=[],this.pointArray=[],this.mousemove=t=>{if(null===this.mode)return;const e=this.getClosestIntersection(t);if(e){if(this.tempPointMarker?this.tempPointMarker.position.set(e.x,e.y,e.z):(this.tempPointMarker=this.createPointMarker(e),this.scene.add(this.tempPointMarker)),this.pointArray.length>0){const t=this.pointArray[this.pointArray.length-1],s=this.tempLine||this.createLine(),i=s.geometry,r=this.pointArray[0],o=this.pointArray[this.pointArray.length-1];if(this.mode===y.Area?i.setFromPoints([o,e,r]):i.setFromPoints([o,e]),this.mode===y.Distance){const s=t.distanceTo(e),i=`${u(A(s,"m",this.options.unit).value,this.options.precision)} ${this.getUnitString()}`,r=new n((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2);this.addOrUpdateTempLabel(i,r)}this.tempLine||(this.scene.add(s),this.tempLine=s)}this.ssp.render()}},this.dblclick=t=>{this.click(t),this.done()},this.click=t=>{if(null===this.mode)return;const e=this.getClosestIntersection(t);if(!e)return;const s=Date.now();if(this.lastClickTime&&s-this.lastClickTime<300)return;this.lastClickTime=s,this.pointArray.push(e);const i=this.pointArray.length,n=this.createPointMarker(e);if(this.pointMarkers.push(n),this.scene.add(n),this.polyline&&(this.polyline.geometry.setFromPoints(this.pointArray),this.tempLabel&&i>1)){const t=this.pointArray[i-2];this.tempLabel.position.set((t.x+e.x)/2,(t.y+e.y)/2,(t.z+e.z)/2),this.scene.add(this.tempLabel),this.labels.push(this.tempLabel),this.tempLabel=void 0}if(this.mode===y.Area&&this.faces){const t=this.faces.geometry,s=this.faces.userData.vertices;s.push(e),t.setFromPoints(s);const i=s.length;if(i>2){const e=[];for(let t=1;t<i-1;++t)e.push(0,t,t+1);t.setIndex(e)}}this.mode===y.Angle&&this.pointArray.length>=3&&this.done(),this.ssp.render()},this.keydown=t=>{"Enter"===t.key?this.done():"Escape"===t.key&&this.cancel()},this.getClosestIntersection=t=>{if(null===this.mode)return;let e=this.ssp.viewport.getIntersects(t);return e&&e.length>0&&(e=e.filter((t=>t.object.name!==b.OBJ_NAME&&t.object.visible)),e.length>0&&e[0].distance<b.MAX_DISTANCE)?e[0].point:null};const{viewport:{scene:e,camera:s}}=t;this.scene=e,this.camera=s}get domElement(){return this.ssp.domElement}start(t=y.Distance,e={}){const{unit:s="m",precision:i=2}=e;this.mode=t,this.options.unit=s,this.options.precision=i,this.ssp.signals.mouseMove.add(this.mousemove),this.ssp.signals.click.add(this.click),this.ssp.signals.dblClick.add(this.dblclick),this.ssp.signals.keyDown.add(this.keydown),this.pointArray=[],this.polyline=this.createLine(),this.scene.add(this.polyline),this.mode===y.Area&&(this.faces=this.createFaces(),this.scene.add(this.faces)),this.domElement.style.cursor="crosshair"}close(){null!==this.mode&&(this.ssp.signals.mouseMove.remove(this.mousemove),this.ssp.signals.click.remove(this.click),this.ssp.signals.dblClick.remove(this.dblclick),this.ssp.signals.keyDown.remove(this.keydown),this.mode=null,this.domElement.style.cursor="",this.pointArray=[],this.tempPointMarker&&this.scene.remove(this.tempPointMarker),this.tempLine&&this.scene.remove(this.tempLine),this.tempLabel&&this.ssp.removeObject(this.tempLabel),this.pointMarkers.forEach((t=>this.scene.remove(t))),this.polyline&&this.scene.remove(this.polyline),this.faces&&this.scene.remove(this.faces),this.curve&&this.scene.remove(this.curve),this.labels.forEach((t=>this.ssp.removeObject(t))),this.tempPointMarker=void 0,this.tempLine=void 0,this.tempLabel=void 0,this.pointMarkers=[],this.polyline=void 0,this.faces=void 0,this.curve=void 0,this.labels=[],this.ssp.render())}cancel(){this.close(),this.onCancel()}clear(){this.objectsStore.forEach((t=>this.ssp.removeObject(t))),this.objectsStore.clear()}initPointMarkerMaterial(){const e=t.utils.textureLoader.load("data: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G4t92KSPx2rVpW/bLtfPOEfy649Bl3NGwTOgJBh9E3wDSInWRD8kWJ/a6hP3NoeHeo+2J2fN08vm2dXt0KHxyQNtc+WJemm+EAnJ2Zvnjs0YVYO4oCwYDPaB5x0kKS6KIickKS6KIick2THVf+2LmlE7iAIygXrbwSZw9eg0054+Wvhm+/X+A0aLIBTEB9lBZdAeDADTwUqwHRzY9tVX234Pl06eGq62xt8Z3YIgEAYiZ/L5mWLPYfOv3AA=");this.spriteMaterial=new r({map:e,depthTest:!1,depthWrite:!1,sizeAttenuation:!1,opacity:.8})}createPointMarker(t){this.spriteMaterial||this.initPointMarkerMaterial();const e=.012,s=new o(this.spriteMaterial);return s.scale.set(e,e,e),t&&s.position.copy(t),s.name=b.OBJ_NAME,s}createLine(t=b.LINE_MATERIAL){const e=new h,s=new a(e,t);return s.frustumCulled=!1,s.name=b.OBJ_NAME,s}createFaces(){const t=new h,e=new l(t,b.MESH_MATERIAL);return e.userData.vertices=[],e.frustumCulled=!1,e.name=b.OBJ_NAME,e}done(){if(null===this.mode)return;let t=!1;const e=this.pointArray.length;if(this.mode===y.Area&&this.polyline)if(e>2){const t=this.pointArray[0];this.polyline.geometry.setFromPoints([...this.pointArray,t]);const e=this.calculateArea(this.pointArray),s=`${u(A(e,"m",this.options.unit,2).value,this.options.precision)} ${this.getUnitString()}`,i=this.getBarycenter(this.pointArray),n=this.createLabel(s);n.position.copy(i),n.element&&(n.element.innerHTML=s),this.labels.push(n)}else t=!0;if(this.mode===y.Distance&&e<2&&(t=!0),this.mode===y.Angle&&this.polyline)if(e>=3){const t=this.pointArray[0],e=this.pointArray[1],s=this.pointArray[2],i=new n(t.x-e.x,t.y-e.y,t.z-e.z).normalize(),r=this.getAngleBisector(t,e,s),o=new n(s.x-e.x,s.y-e.y,s.z-e.z).normalize(),h=this.calculateAngle(t,e,s),a=`${u(h,this.options.precision)} ${this.getUnitString()}`,l=Math.min(t.distanceTo(e),s.distanceTo(e));let c=.3*l,p=e.clone().add(new n(r.x*c,r.y*c,r.z*c));const d=this.createLabel(a);d.position.set(p.x,p.y,p.z),d.element.innerHTML=a,this.labels.push(d),c=.2*l,p=e.clone().add(new n(r.x*c,r.y*c,r.z*c));const m=e.clone().add(new n(i.x*c,i.y*c,i.z*c)),A=e.clone().add(new n(o.x*c,o.y*c,o.z*c));this.curve=this.createCurve(m,p,A),this.scene.add(this.curve)}else t=!0;t||(this.pointMarkers.length>0&&this.pointMarkers.forEach((t=>this.objectsStore.add(t))),this.polyline&&this.objectsStore.add(this.polyline),this.faces&&this.objectsStore.add(this.faces),this.curve&&this.objectsStore.add(this.curve),this.labels.length>0&&this.labels.forEach((t=>this.objectsStore.add(t))),this.pointMarkers=[],this.polyline=void 0,this.faces=void 0,this.curve=void 0,this.labels=[]),this.close(),this.ssp.render(),this.onDone()}addOrUpdateTempLabel(t,e){this.tempLabel||(this.tempLabel=this.createLabel(t)),this.tempLabel.position.set(e.x,e.y,e.z),this.tempLabel.element.innerHTML=t}createLabel(t){const e=document.createElement("div");e.innerHTML=t,e.style.padding="3px 6px",e.style.color="#fff",e.style.fontSize="12px",e.style.position="absolute",e.style.backgroundColor="rgba(25, 25, 25, 0.3)",e.style.borderRadius="12px",e.style.top="0px",e.style.left="0px";const s=this.ssp.createPoiNode({id:f(),element:e,type:"2D"});return s.name=b.LABEL_NAME,s}createCurve(t,e,s){const i=new c(t,e,s).getPoints(4),n=(new h).setFromPoints(i),r=new a(n,b.LINE_MATERIAL);return r.name=b.OBJ_NAME,r}calculateArea(t){let e=0;for(let s=0,i=1,n=2;n<t.length;i++,n++){const r=t[s].distanceTo(t[i]),o=t[i].distanceTo(t[n]),h=t[n].distanceTo(t[s]),a=(r+o+h)/2;e+=Math.sqrt(a*(a-r)*(a-o)*(a-h))}return e}calculateAngle(t,e,s){const i=t,r=e,o=s,h=new n(i.x-r.x,i.y-r.y,i.z-r.z),a=new n(o.x-r.x,o.y-r.y,o.z-r.z);return 180*h.angleTo(a)/Math.PI}getAngleBisector(t,e,s){const i=t,r=e,o=s,h=new n(i.x-r.x,i.y-r.y,i.z-r.z).normalize(),a=new n(o.x-r.x,o.y-r.y,o.z-r.z).normalize();return new n(h.x+a.x,h.y+a.y,h.z+a.z).normalize()}getBarycenter(t){const e=t.length;let s=0,i=0,r=0;return t.forEach((t=>{s+=t.x,i+=t.y,r+=t.z})),new n(s/e,i/e,r/e)}getUnitString(){return this.mode===y.Distance?m(this.options.unit):this.mode===y.Area?`${m(this.options.unit,2)}`:this.mode===y.Angle?"°":""}numberToString(t){if(t<1e-4)return t.toString();let e=2;return t<.01?e=4:t<.1&&(e=3),t.toFixed(e)}}b.LINE_MATERIAL=new e({color:16773120,linewidth:2,opacity:.8,transparent:!0,side:s,depthWrite:!1,depthTest:!1}),b.MESH_MATERIAL=new i({color:8900346,transparent:!0,opacity:.8,side:s,depthWrite:!1,depthTest:!1}),b.MAX_DISTANCE=500,b.OBJ_NAME="object_for_measure"+f(),b.LABEL_NAME="label_for_measure"+f();export{y as MeasuringMode,b as default};
1
+ import t from"soonspacejs";import{LineBasicMaterial as e,DoubleSide as s,MeshBasicMaterial as i,Vector3 as n,SpriteMaterial as r,Sprite as o,BufferGeometry as h,Line as a,Mesh as l,QuadraticBezierCurve3 as c}from"three";const p={m:1,mm:.001,cm:.01,ft:.3048,in:.0254,pt:function(){const t=document.createElement("div");return t.setAttribute("style","height: 1in; visibility: hidden; position: absolute; margin: 0; padding: 0;"),document.body.appendChild(t),.0254/t.clientHeight}()},d=t=>2===t?"²":3===t?"³":"",m=(t,e=1)=>t+d(e),A=(t,e,s,i=1)=>{if(null==s&&(s=e),s===e)return{value:t,unit:m(s)};return{value:t*Math.pow(p[e]/p[s],i),unit:m(s)+d(i)}},u=(t,e)=>t.toFixed(e);var y;!function(t){t.Distance="Distance",t.Area="Area",t.Angle="Angle"}(y||(y={}));const{utils:{randomString:f}}=t;class b{constructor(t){this.ssp=t,this.mode=null,this.options={unit:"m",precision:2},this.objectsStore=new Set,this.onCancel=()=>{},this.onDone=()=>{},this.pointMarkers=[],this.labels=[],this.pointArray=[],this.mousemove=t=>{if(null===this.mode)return;const e=this.getClosestIntersection(t);if(e){if(this.tempPointMarker?this.tempPointMarker.position.set(e.x,e.y,e.z):(this.tempPointMarker=this.createPointMarker(e),this.scene.add(this.tempPointMarker)),this.pointArray.length>0){const t=this.pointArray[this.pointArray.length-1],s=this.tempLine||this.createLine(),i=s.geometry,r=this.pointArray[0],o=this.pointArray[this.pointArray.length-1];if(this.mode===y.Area?i.setFromPoints([o,e,r]):i.setFromPoints([o,e]),this.mode===y.Distance){const s=t.distanceTo(e),i=`${u(A(s,"m",this.options.unit).value,this.options.precision)} ${this.getUnitString()}`,r=new n((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2);this.addOrUpdateTempLabel(i,r)}this.tempLine||(this.scene.add(s),this.tempLine=s)}this.ssp.render()}},this.dblclick=t=>{this.click(t),this.done()},this.click=t=>{if(null===this.mode)return;const e=this.getClosestIntersection(t);if(!e)return;const s=Date.now();if(this.lastClickTime&&s-this.lastClickTime<300)return;this.lastClickTime=s,this.pointArray.push(e);const i=this.pointArray.length,n=this.createPointMarker(e);if(this.pointMarkers.push(n),this.scene.add(n),this.polyline&&(this.polyline.geometry.setFromPoints(this.pointArray),this.tempLabel&&i>1)){const t=this.pointArray[i-2];this.tempLabel.position.set((t.x+e.x)/2,(t.y+e.y)/2,(t.z+e.z)/2),this.scene.add(this.tempLabel),this.labels.push(this.tempLabel),this.tempLabel=void 0}if(this.mode===y.Area&&this.faces){const t=this.faces.geometry,s=this.faces.userData.vertices;s.push(e),t.setFromPoints(s);const i=s.length;if(i>2){const e=[];for(let t=1;t<i-1;++t)e.push(0,t,t+1);t.setIndex(e)}}this.mode===y.Angle&&this.pointArray.length>=3&&this.done(),this.ssp.render()},this.keydown=t=>{"Enter"===t.key?this.done():"Escape"===t.key&&this.cancel()},this.getClosestIntersection=t=>{if(null===this.mode)return;let e=this.ssp.viewport.getIntersects(t);return e&&e.length>0&&(e=e.filter(t=>t.object.name!==b.OBJ_NAME&&t.object.visible),e.length>0&&e[0].distance<b.MAX_DISTANCE)?e[0].point:null};const{viewport:{scene:e,camera:s}}=t;this.scene=e,this.camera=s}get domElement(){return this.ssp.domElement}start(t=y.Distance,e={}){const{unit:s="m",precision:i=2}=e;this.mode=t,this.options.unit=s,this.options.precision=i,this.ssp.signals.mouseMove.add(this.mousemove),this.ssp.signals.click.add(this.click),this.ssp.signals.dblClick.add(this.dblclick),this.ssp.signals.keyDown.add(this.keydown),this.pointArray=[],this.polyline=this.createLine(),this.scene.add(this.polyline),this.mode===y.Area&&(this.faces=this.createFaces(),this.scene.add(this.faces)),this.domElement.style.cursor="crosshair"}close(){null!==this.mode&&(this.ssp.signals.mouseMove.remove(this.mousemove),this.ssp.signals.click.remove(this.click),this.ssp.signals.dblClick.remove(this.dblclick),this.ssp.signals.keyDown.remove(this.keydown),this.mode=null,this.domElement.style.cursor="",this.pointArray=[],this.tempPointMarker&&this.scene.remove(this.tempPointMarker),this.tempLine&&this.scene.remove(this.tempLine),this.tempLabel&&this.ssp.removeObject(this.tempLabel),this.pointMarkers.forEach(t=>this.scene.remove(t)),this.polyline&&this.scene.remove(this.polyline),this.faces&&this.scene.remove(this.faces),this.curve&&this.scene.remove(this.curve),this.labels.forEach(t=>this.ssp.removeObject(t)),this.tempPointMarker=void 0,this.tempLine=void 0,this.tempLabel=void 0,this.pointMarkers=[],this.polyline=void 0,this.faces=void 0,this.curve=void 0,this.labels=[],this.ssp.render())}cancel(){this.close(),this.onCancel()}clear(){this.objectsStore.forEach(t=>this.ssp.removeObject(t)),this.objectsStore.clear()}initPointMarkerMaterial(){const e=t.utils.textureLoader.load("data:image/webp;base64,UklGRkQKAABXRUJQVlA4TDcKAAAvf8AfEPXYu/7fldLqffq1m957773PvGmmnNn7tr+2a7MtsCLfFPA64lEOkVxiOQ79un+LMKYHxiu6FhmcEJyAXUgcQq4jcXAlSbJp7X9NN59t27bfud8MI0mKqigsj0cFBa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wSZw9eg0054+Wvhm+/X+A0aLIBTEB9lBZdAeDADTwUqwHRzY9tVX234Pl06eGq62xt8Z3YIgEAYiZ/L5mWLPYfOv3AA=");this.spriteMaterial=new r({map:e,depthTest:!1,depthWrite:!1,sizeAttenuation:!1,opacity:.8})}createPointMarker(t){this.spriteMaterial||this.initPointMarkerMaterial();const e=.012,s=new o(this.spriteMaterial);return s.scale.set(e,e,e),t&&s.position.copy(t),s.name=b.OBJ_NAME,s}createLine(t=b.LINE_MATERIAL){const e=new h,s=new a(e,t);return s.frustumCulled=!1,s.name=b.OBJ_NAME,s}createFaces(){const t=new h,e=new l(t,b.MESH_MATERIAL);return e.userData.vertices=[],e.frustumCulled=!1,e.name=b.OBJ_NAME,e}done(){if(null===this.mode)return;let t=!1;const e=this.pointArray.length;if(this.mode===y.Area&&this.polyline)if(e>2){const t=this.pointArray[0];this.polyline.geometry.setFromPoints([...this.pointArray,t]);const e=this.calculateArea(this.pointArray),s=`${u(A(e,"m",this.options.unit,2).value,this.options.precision)} ${this.getUnitString()}`,i=this.getBarycenter(this.pointArray),n=this.createLabel(s);n.position.copy(i),n.element&&(n.element.innerHTML=s),this.labels.push(n)}else t=!0;if(this.mode===y.Distance&&e<2&&(t=!0),this.mode===y.Angle&&this.polyline)if(e>=3){const t=this.pointArray[0],e=this.pointArray[1],s=this.pointArray[2],i=new n(t.x-e.x,t.y-e.y,t.z-e.z).normalize(),r=this.getAngleBisector(t,e,s),o=new n(s.x-e.x,s.y-e.y,s.z-e.z).normalize(),h=this.calculateAngle(t,e,s),a=`${u(h,this.options.precision)} ${this.getUnitString()}`,l=Math.min(t.distanceTo(e),s.distanceTo(e));let c=.3*l,p=e.clone().add(new n(r.x*c,r.y*c,r.z*c));const d=this.createLabel(a);d.position.set(p.x,p.y,p.z),d.element.innerHTML=a,this.labels.push(d),c=.2*l,p=e.clone().add(new n(r.x*c,r.y*c,r.z*c));const m=e.clone().add(new n(i.x*c,i.y*c,i.z*c)),A=e.clone().add(new n(o.x*c,o.y*c,o.z*c));this.curve=this.createCurve(m,p,A),this.scene.add(this.curve)}else t=!0;t||(this.pointMarkers.length>0&&this.pointMarkers.forEach(t=>this.objectsStore.add(t)),this.polyline&&this.objectsStore.add(this.polyline),this.faces&&this.objectsStore.add(this.faces),this.curve&&this.objectsStore.add(this.curve),this.labels.length>0&&this.labels.forEach(t=>this.objectsStore.add(t)),this.pointMarkers=[],this.polyline=void 0,this.faces=void 0,this.curve=void 0,this.labels=[]),this.close(),this.ssp.render(),this.onDone()}addOrUpdateTempLabel(t,e){this.tempLabel||(this.tempLabel=this.createLabel(t)),this.tempLabel.position.set(e.x,e.y,e.z),this.tempLabel.element.innerHTML=t}createLabel(t){const e=document.createElement("div");e.innerHTML=t,e.style.padding="3px 6px",e.style.color="#fff",e.style.fontSize="12px",e.style.position="absolute",e.style.backgroundColor="rgba(25, 25, 25, 0.3)",e.style.borderRadius="12px",e.style.top="0px",e.style.left="0px";const s=this.ssp.createPoiNode({id:f(),element:e,type:"2D"});return s.name=b.LABEL_NAME,s}createCurve(t,e,s){const i=new c(t,e,s).getPoints(4),n=(new h).setFromPoints(i),r=new a(n,b.LINE_MATERIAL);return r.name=b.OBJ_NAME,r}calculateArea(t){let e=0;for(let s=0,i=1,n=2;n<t.length;i++,n++){const r=t[s].distanceTo(t[i]),o=t[i].distanceTo(t[n]),h=t[n].distanceTo(t[s]),a=(r+o+h)/2;e+=Math.sqrt(a*(a-r)*(a-o)*(a-h))}return e}calculateAngle(t,e,s){const i=t,r=e,o=s,h=new n(i.x-r.x,i.y-r.y,i.z-r.z),a=new n(o.x-r.x,o.y-r.y,o.z-r.z);return 180*h.angleTo(a)/Math.PI}getAngleBisector(t,e,s){const i=t,r=e,o=s,h=new n(i.x-r.x,i.y-r.y,i.z-r.z).normalize(),a=new n(o.x-r.x,o.y-r.y,o.z-r.z).normalize();return new n(h.x+a.x,h.y+a.y,h.z+a.z).normalize()}getBarycenter(t){const e=t.length;let s=0,i=0,r=0;return t.forEach(t=>{s+=t.x,i+=t.y,r+=t.z}),new n(s/e,i/e,r/e)}getUnitString(){return this.mode===y.Distance?m(this.options.unit):this.mode===y.Area?`${m(this.options.unit,2)}`:this.mode===y.Angle?"°":""}numberToString(t){if(t<1e-4)return t.toString();let e=2;return t<.01?e=4:t<.1&&(e=3),t.toFixed(e)}}b.LINE_MATERIAL=new e({color:16773120,linewidth:2,opacity:.8,transparent:!0,side:s,depthWrite:!1,depthTest:!1}),b.MESH_MATERIAL=new i({color:8900346,transparent:!0,opacity:.8,side:s,depthWrite:!1,depthTest:!1}),b.MAX_DISTANCE=500,b.OBJ_NAME="object_for_measure"+f(),b.LABEL_NAME="label_for_measure"+f();export{y as MeasuringMode,b as default};
@@ -1 +1 @@
1
- export declare const showPrecisionValue: (value: number, precistionType: number) => string;
1
+ export declare const showPrecisionValue: (value: number, precistionType: number) => string;
@@ -1,5 +1,5 @@
1
- export type UnitType = 'm' | 'mm' | 'cm' | 'ft' | 'in' | 'pt';
2
- export interface Options {
3
- unit?: UnitType;
4
- precision?: number;
5
- }
1
+ export type UnitType = 'm' | 'mm' | 'cm' | 'ft' | 'in' | 'pt';
2
+ export interface Options {
3
+ unit?: UnitType;
4
+ precision?: number;
5
+ }
@@ -1,15 +1,15 @@
1
- import { UnitType } from './ProjectSettingsDef';
2
- export declare const unitConversionByMeter: Record<UnitType, number>;
3
- export declare const getUnitStr: (unit: UnitType, power?: number) => string;
4
- /**
5
- * Gets unit
6
- * value
7
- * sourceUnit
8
- * targetUnit
9
- */
10
- interface valueWithUnit {
11
- value: number;
12
- unit: string;
13
- }
14
- export declare const getLengthValueByUnit: (value: number, sourceUnit: UnitType, targetUnit: UnitType, power?: number) => valueWithUnit;
15
- export {};
1
+ import { UnitType } from './ProjectSettingsDef';
2
+ export declare const unitConversionByMeter: Record<UnitType, number>;
3
+ export declare const getUnitStr: (unit: UnitType, power?: number) => string;
4
+ /**
5
+ * Gets unit
6
+ * value
7
+ * sourceUnit
8
+ * targetUnit
9
+ */
10
+ interface valueWithUnit {
11
+ value: number;
12
+ unit: string;
13
+ }
14
+ export declare const getLengthValueByUnit: (value: number, sourceUnit: UnitType, targetUnit: UnitType, power?: number) => valueWithUnit;
15
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-measuring",
3
3
  "pluginName": "MeasuringPlugin",
4
- "version": "2.13.10",
4
+ "version": "2.13.11",
5
5
  "description": "Measuring plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -13,8 +13,8 @@
13
13
  ],
14
14
  "author": "xunwei",
15
15
  "license": "UNLICENSED",
16
- "gitHead": "6bca3b98477ef9c2fa0ba5f67d461561896bb0ff",
16
+ "gitHead": "08bf9efb38c291f22ca044b936fd49269c716bbb",
17
17
  "peerDependencies": {
18
- "soonspacejs": "2.13.10"
18
+ "soonspacejs": "2.13.11"
19
19
  }
20
20
  }