@roomle/web-sdk 2.62.0-alpha.3 → 2.62.0-alpha.4
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/lib/{banana-for-scale-ae26de56.js → banana-for-scale-c4a33098.js} +2 -2
- package/lib/{banana-for-scale-ae26de56.js.map → banana-for-scale-c4a33098.js.map} +1 -1
- package/lib/{banana-for-scale-0dce6d9d.nomodule.js → banana-for-scale-d2707d3a.nomodule.js} +2 -2
- package/lib/{banana-for-scale-0dce6d9d.nomodule.js.map → banana-for-scale-d2707d3a.nomodule.js.map} +1 -1
- package/lib/{component-dimensioning-2cec6820.nomodule.js → component-dimensioning-1319be8f.nomodule.js} +2 -2
- package/lib/component-dimensioning-1319be8f.nomodule.js.map +1 -0
- package/lib/{component-dimensioning-3648c91c.js → component-dimensioning-389dc894.js} +2 -2
- package/lib/component-dimensioning-389dc894.js.map +1 -0
- package/lib/{component-raycast-helper-3f912814.nomodule.js → component-raycast-helper-4a0456c1.nomodule.js} +2 -2
- package/lib/component-raycast-helper-4a0456c1.nomodule.js.map +1 -0
- package/lib/{component-raycast-helper-daa3e64c.js → component-raycast-helper-e2956b00.js} +2 -2
- package/lib/component-raycast-helper-e2956b00.js.map +1 -0
- package/lib/{configurator-4abfb5d9.js → configurator-a432160a.js} +2 -2
- package/lib/configurator-a432160a.js.map +1 -0
- package/lib/{configurator-b056dc92.nomodule.js → configurator-f6c18b4f.nomodule.js} +2 -2
- package/lib/configurator-f6c18b4f.nomodule.js.map +1 -0
- package/lib/configurator-main-7d317938.js +2 -0
- package/lib/configurator-main-7d317938.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{continuous-drawing-helper-5e5cdf1d.nomodule.js → continuous-drawing-helper-07739909.nomodule.js} +2 -2
- package/lib/continuous-drawing-helper-07739909.nomodule.js.map +1 -0
- package/lib/{continuous-drawing-helper-f0d67a67.js → continuous-drawing-helper-2dc3cb40.js} +2 -2
- package/lib/continuous-drawing-helper-2dc3cb40.js.map +1 -0
- package/lib/{default-light-setting-1bc01b3d.js → default-light-setting-0e777c93.js} +2 -2
- package/lib/default-light-setting-0e777c93.js.map +1 -0
- package/lib/{default-light-setting-af06b285.nomodule.js → default-light-setting-e6f7b96c.nomodule.js} +2 -2
- package/lib/default-light-setting-e6f7b96c.nomodule.js.map +1 -0
- package/lib/definitions/common-core/src/utils/init-data.d.ts +1 -0
- package/lib/definitions/common-core/src/utils/shims.d.ts +4 -0
- package/lib/definitions/common-core/src/webgl/image-renderer.d.ts +1 -1
- package/lib/definitions/configurator-core/src/webgl/configurator-scene-event-handler.d.ts +2 -0
- package/lib/definitions/configurator-core/src/webgl/configurator-scene-manager.d.ts +1 -0
- package/lib/{dimensioning-helper-2e4afa2a.js → dimensioning-helper-9b64c1d3.js} +2 -2
- package/lib/{dimensioning-helper-2e4afa2a.js.map → dimensioning-helper-9b64c1d3.js.map} +1 -1
- package/lib/{dimensioning-helper-c5a31177.nomodule.js → dimensioning-helper-fe23dfaf.nomodule.js} +2 -2
- package/lib/{dimensioning-helper-c5a31177.nomodule.js.map → dimensioning-helper-fe23dfaf.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-55584b69.js → glb-viewer-9a11a5b0.js} +2 -2
- package/lib/{glb-viewer-55584b69.js.map → glb-viewer-9a11a5b0.js.map} +1 -1
- package/lib/{glb-viewer-c7a1793b.nomodule.js → glb-viewer-cec299f7.nomodule.js} +2 -2
- package/lib/{glb-viewer-c7a1793b.nomodule.js.map → glb-viewer-cec299f7.nomodule.js.map} +1 -1
- package/lib/glb-viewer-main-235aab0c.js +2 -0
- package/lib/glb-viewer-main-235aab0c.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/legacy/{banana-for-scale-14d3a6f4.legacy.js → banana-for-scale-88d8581a.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-14d3a6f4.legacy.js.map → banana-for-scale-88d8581a.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-18554c9d.legacy.js → component-dimensioning-a79959a0.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-a79959a0.legacy.js.map +1 -0
- package/lib/legacy/{component-raycast-helper-3586c5bc.legacy.js → component-raycast-helper-26dd569c.legacy.js} +2 -2
- package/lib/legacy/component-raycast-helper-26dd569c.legacy.js.map +1 -0
- package/lib/legacy/{configurator-3d44a51b.legacy.js → configurator-ae13408f.legacy.js} +2 -2
- package/lib/legacy/configurator-ae13408f.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{continuous-drawing-helper-06edaa11.legacy.js → continuous-drawing-helper-c7da1629.legacy.js} +2 -2
- package/lib/legacy/continuous-drawing-helper-c7da1629.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-8133dce8.legacy.js → default-light-setting-6d0f5156.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-6d0f5156.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-a2c975ec.legacy.js → dimensioning-helper-de3fe813.legacy.js} +2 -2
- package/lib/legacy/{dimensioning-helper-a2c975ec.legacy.js.map → dimensioning-helper-de3fe813.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-84ab52d9.legacy.js → glb-viewer-5f648a61.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-84ab52d9.legacy.js.map → glb-viewer-5f648a61.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{material-viewer-8b33658e.legacy.js → material-viewer-15308efe.legacy.js} +2 -2
- package/lib/legacy/material-viewer-15308efe.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/{planner-6bd1d973.legacy.js → planner-fcae1334.legacy.js} +2 -2
- package/lib/legacy/{planner-6bd1d973.legacy.js.map → planner-fcae1334.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/roomle-configurator-788f21c9.legacy.js +2 -0
- package/lib/legacy/roomle-configurator-788f21c9.legacy.js.map +1 -0
- package/lib/legacy/{roomle-dependency-injection-288cb79b.legacy.js → roomle-dependency-injection-5ba725ab.legacy.js} +3 -3
- package/lib/legacy/{roomle-dependency-injection-288cb79b.legacy.js.map → roomle-dependency-injection-5ba725ab.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/{scene-manager-1c3e399b.legacy.js → scene-manager-867bbd63.legacy.js} +2 -2
- package/lib/legacy/{scene-manager-1c3e399b.legacy.js.map → scene-manager-867bbd63.legacy.js.map} +1 -1
- package/lib/legacy/{script-loader-6f8ede0e.legacy.js → script-loader-1137a1f3.legacy.js} +2 -2
- package/lib/legacy/script-loader-1137a1f3.legacy.js.map +1 -0
- package/lib/legacy/{stats-helper-53c97cd7.legacy.js → stats-helper-c7d64341.legacy.js} +2 -2
- package/lib/legacy/stats-helper-c7d64341.legacy.js.map +1 -0
- package/lib/legacy/{tools-core-e0004184.legacy.js → tools-core-12dafc66.legacy.js} +2 -2
- package/lib/legacy/tools-core-12dafc66.legacy.js.map +1 -0
- package/lib/{material-viewer-cbdd689a.js → material-viewer-34d3e0e5.js} +2 -2
- package/lib/material-viewer-34d3e0e5.js.map +1 -0
- package/lib/{material-viewer-02425270.nomodule.js → material-viewer-72f2d5db.nomodule.js} +2 -2
- package/lib/material-viewer-72f2d5db.nomodule.js.map +1 -0
- package/lib/material-viewer-main-98214c56.js +2 -0
- package/lib/material-viewer-main-98214c56.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/{planner-1493b954.js → planner-d0144c2d.js} +2 -2
- package/lib/{planner-1493b954.js.map → planner-d0144c2d.js.map} +1 -1
- package/lib/{planner-13087ddc.nomodule.js → planner-e9de8f30.nomodule.js} +2 -2
- package/lib/{planner-13087ddc.nomodule.js.map → planner-e9de8f30.nomodule.js.map} +1 -1
- package/lib/planner-main-da9a2058.js +2 -0
- package/lib/planner-main-da9a2058.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/roomle-configurator-2fe2645f.nomodule.js +2 -0
- package/lib/roomle-configurator-2fe2645f.nomodule.js.map +1 -0
- package/lib/roomle-configurator-e440c1ed.js +2 -0
- package/lib/roomle-configurator-e440c1ed.js.map +1 -0
- package/lib/{roomle-dependency-injection-b38984ab.js → roomle-dependency-injection-a6b6e5b9.js} +3 -3
- package/lib/{roomle-dependency-injection-b38984ab.js.map → roomle-dependency-injection-a6b6e5b9.js.map} +1 -1
- package/lib/{roomle-dependency-injection-fd98553c.nomodule.js → roomle-dependency-injection-e730f5db.nomodule.js} +3 -3
- package/lib/{roomle-dependency-injection-fd98553c.nomodule.js.map → roomle-dependency-injection-e730f5db.nomodule.js.map} +1 -1
- package/lib/{roomle-sdk-affd2371.js → roomle-sdk-745bb5ed.js} +2 -2
- package/lib/roomle-sdk-745bb5ed.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{scene-manager-eca85c5f.nomodule.js → scene-manager-8263aabe.nomodule.js} +2 -2
- package/lib/{scene-manager-eca85c5f.nomodule.js.map → scene-manager-8263aabe.nomodule.js.map} +1 -1
- package/lib/{scene-manager-d05d913f.js → scene-manager-d62ae8cb.js} +2 -2
- package/lib/{scene-manager-d05d913f.js.map → scene-manager-d62ae8cb.js.map} +1 -1
- package/lib/{script-loader-c9998e7d.js → script-loader-91c2a731.js} +2 -2
- package/lib/script-loader-91c2a731.js.map +1 -0
- package/lib/{script-loader-c2540074.nomodule.js → script-loader-d6f3f6fd.nomodule.js} +2 -2
- package/lib/script-loader-d6f3f6fd.nomodule.js.map +1 -0
- package/lib/{stats-helper-e3861bb5.nomodule.js → stats-helper-517ef448.nomodule.js} +2 -2
- package/lib/stats-helper-517ef448.nomodule.js.map +1 -0
- package/lib/{stats-helper-527570de.js → stats-helper-f6f1b022.js} +2 -2
- package/lib/stats-helper-f6f1b022.js.map +1 -0
- package/lib/{tools-core-cca96eac.nomodule.js → tools-core-53ba3292.nomodule.js} +2 -2
- package/lib/tools-core-53ba3292.nomodule.js.map +1 -0
- package/lib/{tools-core-9270b413.js → tools-core-c87dbec3.js} +2 -2
- package/lib/tools-core-c87dbec3.js.map +1 -0
- package/package.json +2 -2
- package/lib/component-dimensioning-2cec6820.nomodule.js.map +0 -1
- package/lib/component-dimensioning-3648c91c.js.map +0 -1
- package/lib/component-raycast-helper-3f912814.nomodule.js.map +0 -1
- package/lib/component-raycast-helper-daa3e64c.js.map +0 -1
- package/lib/configurator-4abfb5d9.js.map +0 -1
- package/lib/configurator-b056dc92.nomodule.js.map +0 -1
- package/lib/configurator-main-e8f20868.js +0 -2
- package/lib/configurator-main-e8f20868.js.map +0 -1
- package/lib/continuous-drawing-helper-5e5cdf1d.nomodule.js.map +0 -1
- package/lib/continuous-drawing-helper-f0d67a67.js.map +0 -1
- package/lib/default-light-setting-1bc01b3d.js.map +0 -1
- package/lib/default-light-setting-af06b285.nomodule.js.map +0 -1
- package/lib/glb-viewer-main-68f332ce.js +0 -2
- package/lib/glb-viewer-main-68f332ce.js.map +0 -1
- package/lib/legacy/component-dimensioning-18554c9d.legacy.js.map +0 -1
- package/lib/legacy/component-raycast-helper-3586c5bc.legacy.js.map +0 -1
- package/lib/legacy/configurator-3d44a51b.legacy.js.map +0 -1
- package/lib/legacy/continuous-drawing-helper-06edaa11.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-8133dce8.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-8b33658e.legacy.js.map +0 -1
- package/lib/legacy/roomle-configurator-60cdb883.legacy.js +0 -2
- package/lib/legacy/roomle-configurator-60cdb883.legacy.js.map +0 -1
- package/lib/legacy/script-loader-6f8ede0e.legacy.js.map +0 -1
- package/lib/legacy/stats-helper-53c97cd7.legacy.js.map +0 -1
- package/lib/legacy/tools-core-e0004184.legacy.js.map +0 -1
- package/lib/material-viewer-02425270.nomodule.js.map +0 -1
- package/lib/material-viewer-cbdd689a.js.map +0 -1
- package/lib/material-viewer-main-0c143e81.js +0 -2
- package/lib/material-viewer-main-0c143e81.js.map +0 -1
- package/lib/planner-main-3a373dc9.js +0 -2
- package/lib/planner-main-3a373dc9.js.map +0 -1
- package/lib/roomle-configurator-178b14f1.nomodule.js +0 -2
- package/lib/roomle-configurator-178b14f1.nomodule.js.map +0 -1
- package/lib/roomle-configurator-8ab35a0a.js +0 -2
- package/lib/roomle-configurator-8ab35a0a.js.map +0 -1
- package/lib/roomle-sdk-affd2371.js.map +0 -1
- package/lib/script-loader-c2540074.nomodule.js.map +0 -1
- package/lib/script-loader-c9998e7d.js.map +0 -1
- package/lib/stats-helper-527570de.js.map +0 -1
- package/lib/stats-helper-e3861bb5.nomodule.js.map +0 -1
- package/lib/tools-core-9270b413.js.map +0 -1
- package/lib/tools-core-cca96eac.nomodule.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ay as ScenePluginDefaultImplementation,_ as __decorate,i as inject}from"./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=banana-for-scale-
|
|
1
|
+
import{ay as ScenePluginDefaultImplementation,_ as __decorate,i as inject}from"./roomle-dependency-injection-a6b6e5b9.js";import{g as getAssetPath,a as Vector3}from"./main-thread-to-worker-d5d5841d.js";class BananaForScale extends ScenePluginDefaultImplementation{setScene(e){this._scene=e,this._staticItemLoader.loadGLB(getAssetPath()+"static/banana_div2-1351c98ec2986be1.glb").then(e=>{this._banana=e.scene,this.updateBounds(null)})}updateBounds(e){if(e&&(this._bounds=e),this._bounds){if(this._banana){const e=this._bounds.getSize(new Vector3),a=this._bounds.getCenter(new Vector3).clone();a.x-=e.x/2+.18,a.z+=e.z/2+.05,a.y=0;let n=.03;this._banana.scale.copy(new Vector3(n,n,n)),this._banana.rotation.y=.6,this._banana.position.copy(a)}this._scene.children.includes(this._banana)||this.addToScene()}}clearScene(e,a){super.clearScene(e,a),this.removeFromScene()}addToScene(){this._scene&&this._banana&&this._scene.add(this._banana)}removeFromScene(){this._scene&&this._banana&&this._scene.remove(this._banana)}}__decorate([inject],BananaForScale.prototype,"_staticItemLoader",void 0);export{BananaForScale as default};
|
|
2
|
+
//# sourceMappingURL=banana-for-scale-c4a33098.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banana-for-scale-
|
|
1
|
+
{"version":3,"file":"banana-for-scale-c4a33098.js","sources":["../../packages/configurator-core/public/geometry/banana_div2.glb"],"sourcesContent":["export default \"static/banana_div2-1351c98ec2986be1.glb\""],"names":[],"mappings":"gVAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=banana-for-scale-
|
|
1
|
+
System.register(["./roomle-dependency-injection-e730f5db.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js"],(function(e){var n,t,a,s,i;return{setters:[function(e){n=e.ay,t=e._,a=e.i},function(e){s=e.g,i=e.a}],execute:function(){class o extends n{setScene(e){this._scene=e,this._staticItemLoader.loadGLB(s()+"static/banana_div2-1351c98ec2986be1.glb").then(e=>{this._banana=e.scene,this.updateBounds(null)})}updateBounds(e){if(e&&(this._bounds=e),this._bounds){if(this._banana){const e=this._bounds.getSize(new i),n=this._bounds.getCenter(new i).clone();n.x-=e.x/2+.18,n.z+=e.z/2+.05,n.y=0;let t=.03;this._banana.scale.copy(new i(t,t,t)),this._banana.rotation.y=.6,this._banana.position.copy(n)}this._scene.children.includes(this._banana)||this.addToScene()}}clearScene(e,n){super.clearScene(e,n),this.removeFromScene()}addToScene(){this._scene&&this._banana&&this._scene.add(this._banana)}removeFromScene(){this._scene&&this._banana&&this._scene.remove(this._banana)}}e("default",o),t([a],o.prototype,"_staticItemLoader",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=banana-for-scale-d2707d3a.nomodule.js.map
|
package/lib/{banana-for-scale-0dce6d9d.nomodule.js.map → banana-for-scale-d2707d3a.nomodule.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banana-for-scale-
|
|
1
|
+
{"version":3,"file":"banana-for-scale-d2707d3a.nomodule.js","sources":["../../packages/configurator-core/public/geometry/banana_div2.glb"],"sourcesContent":["export default \"static/banana_div2-1351c98ec2986be1.glb\""],"names":[],"mappings":"6TAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-dimensioning-
|
|
1
|
+
System.register(["./roomle-dependency-injection-e730f5db.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js","./TextGeometry-f2fc57a2.nomodule.js"],(function(e){var i,t,n,s,o,a,h,d,_,l,r,g,m,c,w,p;return{setters:[function(e){i=e._,t=e.i},function(e){n=e.O,s=e.a,o=e.s,a=e.f,h=e.u,d=e.bg,_=e.B,l=e.z,r=e.x,g=e.b,m=e.Q,c=e.aH,w=e.b5},function(e){p=e.T}],execute:function(){const x="component_dimensioning_line_material",u="component_dimensioning_plane_material",y="component_dimensioning_text_material";class v extends n{constructor(e,i,t,n){super(),this._center=i.getCenter(new s),this._size=i.getSize(new s),this._origin=this._center.clone().sub(this._size.clone().multiplyScalar(.5)),this._dimensioning=e,this._level=this._dimensioning.maxLevel-this._dimensioning.level,this._font=t,this._cameraPosition=n,this._init()}_initMaterials(){this._cacheHolder.materialCache.has(x)?this._lineMaterial=this._cacheHolder.materialCache.get(x):(this._lineMaterial=new o({color:3618615}),this._cacheHolder.materialCache.set(x,this._lineMaterial)),this._cacheHolder.materialCache.has(u)?this._planeMaterial=this._cacheHolder.materialCache.get(u):(this._planeMaterial=new a({color:16777215,side:h,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(u,this._planeMaterial)),this._cacheHolder.materialCache.has(y)?this._textMaterial=this._cacheHolder.materialCache.get(y):(this._textMaterial=new d({color:3618615}),this._cacheHolder.materialCache.set(y,this._textMaterial))}_init(){this._initMaterials();let e=new _;this._line=new l(e,this._lineMaterial),this._line.name="component dimension line "+this._dimensioning.type.value,this._text=new r(e,this._textMaterial),this._text.name="component dimension text "+this._dimensioning.type.value,this._plane=new r(e,this._planeMaterial),this._plane.name="component dimension plane "+this._dimensioning.type.value;let i,t=new _,n=Math.round(Math.max(this._size.y,this._size.x,this._size.z)),o=Math.abs(this._dimensioning.to-this._dimensioning.from),a=.025+(n<4?0:.005*n);o<.3&&(a*=.5+o);let h={font:this._font,size:a,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},d=this._dimensioning.label?this._dimensioning.label:this._unitFormatter.formatMMValueToUnitString(1e3*o),c=new p(d,h);c.computeBoundingBox();let w=c.boundingBox.getSize(new s).y;0===this._dimensioning.type.value&&(i=this._getXEdge(w),this._addXEdgeSideLines(w)),1===this._dimensioning.type.value&&(i=this._getYEdge(w),this._addYEdgeSideLines(w)),2===this._dimensioning.type.value&&(i=this._getZEdge(w),this._addZEdgeSideLines(w));let x=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];if(t.setAttribute("position",new g(new Float32Array(x),3)),this._line.geometry.dispose(),this._line.geometry=t,this.add(this._line),this._text.geometry=c,0===this._dimensioning.type.value&&this._addText(i,c,new m,new s(0,.04,0)),1===this._dimensioning.type.value){let e=new m,t=this._getXSign()>0?Math.PI/2:Math.PI/2*3;e.setFromAxisAngle(new s(0,0,1),t),this._addText(i,c,e,new s(.04,0,0))}if(2===this._dimensioning.type.value){let e=this._getXSign()>0?Math.PI/2:Math.PI/2*3,t=(new m).setFromAxisAngle(new s(-1,0,0),Math.PI/2),n=(new m).setFromAxisAngle(new s(0,0,1),e);this._addText(i,c,t.multiply(n),new s(.04,0,0))}}_getXEdge(e){let i=this._size.y+.05+(.06+e)*this._level;const t=new s(0,this._origin.y,this._origin.z);let n=t.clone().add(new s(this._dimensioning.from,i,0)),o=t.clone().add(new s(this._dimensioning.to,i,0));return new c(n,o)}_addXEdgeSideLines(e){let i=this._size.y+.05+(.06+e)*(this._level-.5),t=this._size.y+.05+(.06+e)*this._level;const n=new s(0,this._origin.y,this._origin.z);let o=n.clone().add(new s(this._dimensioning.from,i,0)),a=n.clone().add(new s(this._dimensioning.from,t,0)),h=n.clone().add(new s(this._dimensioning.to,i,0)),d=n.clone().add(new s(this._dimensioning.to,t,0));this._addLine(o,a),this._addLine(h,d)}_getZEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new s(this._origin.x,this._origin.y,0);let n=t.clone().add(new s(i,0,this._dimensioning.from)),o=t.clone().add(new s(i,0,this._dimensioning.to));return new c(n,o)}_addZEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const o=new s(this._origin.x,this._origin.y,0);let a=o.clone().add(new s(t,0,this._dimensioning.from)),h=o.clone().add(new s(n,0,this._dimensioning.from)),d=o.clone().add(new s(t,0,this._dimensioning.to)),_=o.clone().add(new s(n,0,this._dimensioning.to));this._addLine(a,h),this._addLine(d,_)}_getYEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new s(this._origin.x,0,this._origin.z);let n=t.clone().add(new s(i,this._dimensioning.from,0)),o=t.clone().add(new s(i,this._dimensioning.to,0));return new c(n,o)}_addYEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const o=new s(this._origin.x,0,this._origin.z);let a=o.clone().add(new s(t,this._dimensioning.from,0)),h=o.clone().add(new s(n,this._dimensioning.from,0)),d=o.clone().add(new s(t,this._dimensioning.to,0)),_=o.clone().add(new s(n,this._dimensioning.to,0));this._addLine(a,h),this._addLine(d,_)}_addLine(e,i){let t=new _,n=[e.x,e.y,e.z,i.x,i.y,i.z];t.setAttribute("position",new g(new Float32Array(n),3)),this.add(new l(t,this._lineMaterial))}_addText(e,i,t,n){let o=e.getCenter(new s);n.x*=this._getXSign(),o.add(n);let a=i.boundingBox.getSize(new s);i.center(),this._text.position.copy(o),this._text.quaternion.copy(t),this.add(this._text);let h=new w(a.x+.02,a.y+.02,32);h.center(),this._plane.geometry=h,this._plane.position.copy(o),this._plane.quaternion.copy(t),this.add(this._plane)}_getXSign(){return this._cameraPosition.x>=0?1:-1}}e("default",v),i([t],v.prototype,"_cacheHolder",void 0),i([t],v.prototype,"_unitFormatter",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=component-dimensioning-1319be8f.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-dimensioning-1319be8f.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as __decorate,i as inject}from"./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-dimensioning-
|
|
1
|
+
import{_ as __decorate,i as inject}from"./roomle-dependency-injection-a6b6e5b9.js";import{O as Object3D,a as Vector3,s as LineBasicMaterial,f as MeshBasicMaterial,u as DoubleSide,bg as MeshPhongMaterial,B as BufferGeometry,z as Line,x as Mesh,b as BufferAttribute,Q as Quaternion,aH as Line3,b5 as PlaneGeometry}from"./main-thread-to-worker-d5d5841d.js";import{T as TextGeometry}from"./TextGeometry-d25f1fa4.js";const LINE_MATERIAL="component_dimensioning_line_material",PLANE_MATERIAL="component_dimensioning_plane_material",TEXT_MATERIAL="component_dimensioning_text_material";class ComponentDimensioning extends Object3D{constructor(e,i,t,n){super(),this._center=i.getCenter(new Vector3),this._size=i.getSize(new Vector3),this._origin=this._center.clone().sub(this._size.clone().multiplyScalar(.5)),this._dimensioning=e,this._level=this._dimensioning.maxLevel-this._dimensioning.level,this._font=t,this._cameraPosition=n,this._init()}_initMaterials(){this._cacheHolder.materialCache.has(LINE_MATERIAL)?this._lineMaterial=this._cacheHolder.materialCache.get(LINE_MATERIAL):(this._lineMaterial=new LineBasicMaterial({color:3618615}),this._cacheHolder.materialCache.set(LINE_MATERIAL,this._lineMaterial)),this._cacheHolder.materialCache.has(PLANE_MATERIAL)?this._planeMaterial=this._cacheHolder.materialCache.get(PLANE_MATERIAL):(this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(PLANE_MATERIAL,this._planeMaterial)),this._cacheHolder.materialCache.has(TEXT_MATERIAL)?this._textMaterial=this._cacheHolder.materialCache.get(TEXT_MATERIAL):(this._textMaterial=new MeshPhongMaterial({color:3618615}),this._cacheHolder.materialCache.set(TEXT_MATERIAL,this._textMaterial))}_init(){this._initMaterials();let e=new BufferGeometry;this._line=new Line(e,this._lineMaterial),this._line.name="component dimension line "+this._dimensioning.type.value,this._text=new Mesh(e,this._textMaterial),this._text.name="component dimension text "+this._dimensioning.type.value,this._plane=new Mesh(e,this._planeMaterial),this._plane.name="component dimension plane "+this._dimensioning.type.value;let i,t=new BufferGeometry,n=Math.round(Math.max(this._size.y,this._size.x,this._size.z)),s=Math.abs(this._dimensioning.to-this._dimensioning.from),o=.025+(n<4?0:.005*n);s<.3&&(o*=.5+s);let a={font:this._font,size:o,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},r=this._dimensioning.label?this._dimensioning.label:this._unitFormatter.formatMMValueToUnitString(1e3*s),h=new TextGeometry(r,a);h.computeBoundingBox();let _=h.boundingBox.getSize(new Vector3).y;0===this._dimensioning.type.value&&(i=this._getXEdge(_),this._addXEdgeSideLines(_)),1===this._dimensioning.type.value&&(i=this._getYEdge(_),this._addYEdgeSideLines(_)),2===this._dimensioning.type.value&&(i=this._getZEdge(_),this._addZEdgeSideLines(_));let d=[i.start.x,i.start.y,i.start.z,i.end.x,i.end.y,i.end.z];if(t.setAttribute("position",new BufferAttribute(new Float32Array(d),3)),this._line.geometry.dispose(),this._line.geometry=t,this.add(this._line),this._text.geometry=h,0===this._dimensioning.type.value&&this._addText(i,h,new Quaternion,new Vector3(0,.04,0)),1===this._dimensioning.type.value){let e=new Quaternion,t=this._getXSign()>0?Math.PI/2:Math.PI/2*3;e.setFromAxisAngle(new Vector3(0,0,1),t),this._addText(i,h,e,new Vector3(.04,0,0))}if(2===this._dimensioning.type.value){let e=this._getXSign()>0?Math.PI/2:Math.PI/2*3,t=(new Quaternion).setFromAxisAngle(new Vector3(-1,0,0),Math.PI/2),n=(new Quaternion).setFromAxisAngle(new Vector3(0,0,1),e);this._addText(i,h,t.multiply(n),new Vector3(.04,0,0))}}_getXEdge(e){let i=this._size.y+.05+(.06+e)*this._level;const t=new Vector3(0,this._origin.y,this._origin.z);let n=t.clone().add(new Vector3(this._dimensioning.from,i,0)),s=t.clone().add(new Vector3(this._dimensioning.to,i,0));return new Line3(n,s)}_addXEdgeSideLines(e){let i=this._size.y+.05+(.06+e)*(this._level-.5),t=this._size.y+.05+(.06+e)*this._level;const n=new Vector3(0,this._origin.y,this._origin.z);let s=n.clone().add(new Vector3(this._dimensioning.from,i,0)),o=n.clone().add(new Vector3(this._dimensioning.from,t,0)),a=n.clone().add(new Vector3(this._dimensioning.to,i,0)),r=n.clone().add(new Vector3(this._dimensioning.to,t,0));this._addLine(s,o),this._addLine(a,r)}_getZEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new Vector3(this._origin.x,this._origin.y,0);let n=t.clone().add(new Vector3(i,0,this._dimensioning.from)),s=t.clone().add(new Vector3(i,0,this._dimensioning.to));return new Line3(n,s)}_addZEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const s=new Vector3(this._origin.x,this._origin.y,0);let o=s.clone().add(new Vector3(t,0,this._dimensioning.from)),a=s.clone().add(new Vector3(n,0,this._dimensioning.from)),r=s.clone().add(new Vector3(t,0,this._dimensioning.to)),h=s.clone().add(new Vector3(n,0,this._dimensioning.to));this._addLine(o,a),this._addLine(r,h)}_getYEdge(e){let i=(this._getXSign()>0?this._size.x:0)+.05+(.06+e)*this._level;i*=this._getXSign();const t=new Vector3(this._origin.x,0,this._origin.z);let n=t.clone().add(new Vector3(i,this._dimensioning.from,0)),s=t.clone().add(new Vector3(i,this._dimensioning.to,0));return new Line3(n,s)}_addYEdgeSideLines(e){let i=this._getXSign()>0?this._size.x:0,t=i+.05+(.06+e)*(this._level-.5),n=i+.05+(.06+e)*this._level;t*=this._getXSign(),n*=this._getXSign();const s=new Vector3(this._origin.x,0,this._origin.z);let o=s.clone().add(new Vector3(t,this._dimensioning.from,0)),a=s.clone().add(new Vector3(n,this._dimensioning.from,0)),r=s.clone().add(new Vector3(t,this._dimensioning.to,0)),h=s.clone().add(new Vector3(n,this._dimensioning.to,0));this._addLine(o,a),this._addLine(r,h)}_addLine(e,i){let t=new BufferGeometry,n=[e.x,e.y,e.z,i.x,i.y,i.z];t.setAttribute("position",new BufferAttribute(new Float32Array(n),3)),this.add(new Line(t,this._lineMaterial))}_addText(e,i,t,n){let s=e.getCenter(new Vector3);n.x*=this._getXSign(),s.add(n);let o=i.boundingBox.getSize(new Vector3);i.center(),this._text.position.copy(s),this._text.quaternion.copy(t),this.add(this._text);let a=new PlaneGeometry(o.x+.02,o.y+.02,32);a.center(),this._plane.geometry=a,this._plane.position.copy(s),this._plane.quaternion.copy(t),this.add(this._plane)}_getXSign(){return this._cameraPosition.x>=0?1:-1}}__decorate([inject],ComponentDimensioning.prototype,"_cacheHolder",void 0),__decorate([inject],ComponentDimensioning.prototype,"_unitFormatter",void 0);export{ComponentDimensioning as default};
|
|
2
|
+
//# sourceMappingURL=component-dimensioning-389dc894.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-dimensioning-389dc894.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./main-thread-to-worker-cce716d1.nomodule.js","./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-raycast-helper-
|
|
1
|
+
System.register(["./main-thread-to-worker-cce716d1.nomodule.js","./roomle-dependency-injection-e730f5db.nomodule.js"],(function(e){var t,i,n,s,a,r,c,o,l;return{setters:[function(e){t=e.bv,i=e.bK,n=e.x,s=e.t,a=e.aa,r=e.a,c=e.bL,o=e.j},function(e){l=e.a8}],execute:function(){e("default",class{constructor(){this._nonTransparentComponent=null,this._raycaster=new t,this._raycaster.near=.1,this._raycaster.layers.enable(3)}init(e,t){this._scene=e,this._camera=t,this.checkComponentVisibility=i(this.checkComponentVisibility,100).bind(this),this.checkPreviewVisibility=i(this.checkPreviewVisibility,100).bind(this)}changeMaterialsOnSelect(e,t,i=!1){t!==this._nonTransparentComponent&&(this._nonTransparentComponent=t,this._changeMaterialsOnSelect(e,t,i))}_changeMaterialsOnSelect(e,t,i=!1){if(e.children.length>0&&e.children.forEach(s=>{const a=t&&e.id===t.id||i,r=!(s instanceof n);this._changeMaterialsOnSelect(s,t,(!a||!r)&&a)}),t)e instanceof n&&e.material instanceof s&&!e.userData.oldMaterial&&(e.userData.oldMaterial=e.material,e.material=e.material.clone(),i||l(e,{opacity:.2,transparent:!0}));else if(e.userData.oldMaterial&&e instanceof n&&e.material instanceof s){const{opacity:t,transparent:i}=e.userData.oldMaterial;l(e,{opacity:t,transparent:i}),e.userData.oldMaterial=void 0}}isComponentVisible(e){const t=[];e.traverse(e=>t.push(e.uuid));const i=(new a).setFromObject(e).getCenter(new r),n=(new r).subVectors(i,this._camera.position).normalize();this._raycaster.set(this._camera.position,n),this._raycaster.far=this._camera.position.distanceTo(i);const s=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{e.object.material.visible&&(t.includes(e.object.uuid)||e.object.userData.ignoreComponentRaycast||s.push(e))}),0===s.length}checkComponentAndPreviewVisibility(e,t){e.hasSelection()?this.checkComponentVisibility(e,t):t.hasPreviews()?this.checkPreviewVisibility(t):this.changeMaterialsOnSelect(this._scene,null)}checkComponentVisibility(e,t){if(!e.hasSelection())return;const i=t.getComponentsForIds(e.getSelectedRuntimeComponentIds());if(i.length>1)return;const n=i[0];this.isComponentVisible(n)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,n)}areAllPreviewsVisible(e){if(!e.hasPreviews())return!0;const t=e.getPreviews();return 0===t.length||t.map(e=>this.isComponentVisible(e)).reduce((e,t)=>e&&t)}areAllComponentsInFrustum(e){if(0===e.length)return!0;const t=new c,i=(new o).multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse),n=new a;return t.setFromProjectionMatrix(i),e.map(e=>(e=>{const i=n.setFromObject(e).getCenter(new r);return t.containsPoint(i)})(e)).reduce((e,t)=>e&&t)}checkPreviewVisibility(e){e.hasPreviewLines()||(this.areAllPreviewsVisible(e)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,{id:-1}))}})}}}));
|
|
2
|
+
//# sourceMappingURL=component-raycast-helper-4a0456c1.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-raycast-helper-4a0456c1.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{bv as Raycaster,bK as throttle,x as Mesh,t as MeshStandardMaterial,aa as Box3,a as Vector3,bL as Frustum,j as Matrix4}from"./main-thread-to-worker-d5d5841d.js";import{a8 as transitionTransparencyOfMaterial}from"./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=component-raycast-helper-
|
|
1
|
+
import{bv as Raycaster,bK as throttle,x as Mesh,t as MeshStandardMaterial,aa as Box3,a as Vector3,bL as Frustum,j as Matrix4}from"./main-thread-to-worker-d5d5841d.js";import{a8 as transitionTransparencyOfMaterial}from"./roomle-dependency-injection-a6b6e5b9.js";class ComponentRaycastHelper{constructor(){this._nonTransparentComponent=null,this._raycaster=new Raycaster,this._raycaster.near=.1,this._raycaster.layers.enable(3)}init(e,t){this._scene=e,this._camera=t,this.checkComponentVisibility=throttle(this.checkComponentVisibility,100).bind(this),this.checkPreviewVisibility=throttle(this.checkPreviewVisibility,100).bind(this)}changeMaterialsOnSelect(e,t,i=!1){t!==this._nonTransparentComponent&&(this._nonTransparentComponent=t,this._changeMaterialsOnSelect(e,t,i))}_changeMaterialsOnSelect(e,t,i=!1){if(e.children.length>0&&e.children.forEach(a=>{const s=t&&e.id===t.id||i,n=!(a instanceof Mesh);this._changeMaterialsOnSelect(a,t,(!s||!n)&&s)}),t)e instanceof Mesh&&e.material instanceof MeshStandardMaterial&&!e.userData.oldMaterial&&(e.userData.oldMaterial=e.material,e.material=e.material.clone(),i||transitionTransparencyOfMaterial(e,{opacity:.2,transparent:!0}));else if(e.userData.oldMaterial&&e instanceof Mesh&&e.material instanceof MeshStandardMaterial){const{opacity:t,transparent:i}=e.userData.oldMaterial;transitionTransparencyOfMaterial(e,{opacity:t,transparent:i}),e.userData.oldMaterial=void 0}}isComponentVisible(e){const t=[];e.traverse(e=>t.push(e.uuid));const i=(new Box3).setFromObject(e).getCenter(new Vector3),a=(new Vector3).subVectors(i,this._camera.position).normalize();this._raycaster.set(this._camera.position,a),this._raycaster.far=this._camera.position.distanceTo(i);const s=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{e.object.material.visible&&(t.includes(e.object.uuid)||e.object.userData.ignoreComponentRaycast||s.push(e))}),0===s.length}checkComponentAndPreviewVisibility(e,t){e.hasSelection()?this.checkComponentVisibility(e,t):t.hasPreviews()?this.checkPreviewVisibility(t):this.changeMaterialsOnSelect(this._scene,null)}checkComponentVisibility(e,t){if(!e.hasSelection())return;const i=t.getComponentsForIds(e.getSelectedRuntimeComponentIds());if(i.length>1)return;const a=i[0];this.isComponentVisible(a)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,a)}areAllPreviewsVisible(e){if(!e.hasPreviews())return!0;const t=e.getPreviews();return 0===t.length||t.map(e=>this.isComponentVisible(e)).reduce((e,t)=>e&&t)}areAllComponentsInFrustum(e){if(0===e.length)return!0;const t=new Frustum,i=(new Matrix4).multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse),a=new Box3;return t.setFromProjectionMatrix(i),e.map(e=>(e=>{const i=a.setFromObject(e).getCenter(new Vector3);return t.containsPoint(i)})(e)).reduce((e,t)=>e&&t)}checkPreviewVisibility(e){e.hasPreviewLines()||(this.areAllPreviewsVisible(e)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,{id:-1}))}}export{ComponentRaycastHelper as default};
|
|
2
|
+
//# sourceMappingURL=component-raycast-helper-e2956b00.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-raycast-helper-e2956b00.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as ScriptLoader,M as Main}from"./script-loader-
|
|
2
|
-
//# sourceMappingURL=configurator-
|
|
1
|
+
import{S as ScriptLoader,M as Main}from"./script-loader-91c2a731.js";import{D as DependencyInjectionAssignment,L as Logger,R as RapiAccess,a as DataSyncer,C as ConfiguratorViewModel,b as RoomleDependencyInjection,A as AppContext}from"./roomle-dependency-injection-a6b6e5b9.js";import{C as CameraControl3D,a as CameraControl}from"./scene-manager-d62ae8cb.js";import ComponentRaycastHelper from"./component-raycast-helper-e2956b00.js";import{C as ConfiguratorSceneManager,R as RoomleConfigurator}from"./roomle-configurator-e440c1ed.js";import"./query-params-helper-a271f9dc.js";import"./main-thread-to-worker-d5d5841d.js";import"./default-light-setting-0e777c93.js";const INJECTABLES=[new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("camera-control-3d",CameraControl3D),new DependencyInjectionAssignment("camera-control",CameraControl),new DependencyInjectionAssignment("data-syncer",DataSyncer),new DependencyInjectionAssignment("configurator-scene-manager",ConfiguratorSceneManager,1),new DependencyInjectionAssignment("configurator-view-model",ConfiguratorViewModel,1),new DependencyInjectionAssignment("component-raycast-helper",ComponentRaycastHelper,0)];class Configurator extends Main{setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("planner-kernel-access",this._context).init(1),this.lookup("rapi-access",this._context),this.lookup("script-loader",this._context),this.lookup("logger",this._context)}cleanUpGlobals(){delete window.RoomleConfigurator}cleanUpDependencies(){const e=this.lookup("script-loader"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};AppContext.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new RoomleConfigurator(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}}export{Configurator};
|
|
2
|
+
//# sourceMappingURL=configurator-a432160a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurator-a432160a.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./script-loader-
|
|
2
|
-
//# sourceMappingURL=configurator-
|
|
1
|
+
System.register(["./script-loader-d6f3f6fd.nomodule.js","./roomle-dependency-injection-e730f5db.nomodule.js","./scene-manager-8263aabe.nomodule.js","./component-raycast-helper-4a0456c1.nomodule.js","./roomle-configurator-2fe2645f.nomodule.js","./query-params-helper-c231e1b8.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js","./default-light-setting-e6f7b96c.nomodule.js"],(function(e){var n,o,t,r,c,i,a,s,l,u,p,d,f,g;return{setters:[function(e){n=e.S,o=e.M},function(e){t=e.D,r=e.L,c=e.R,i=e.a,a=e.C,s=e.b,l=e.A},function(e){u=e.C,p=e.a},function(e){d=e.default},function(e){f=e.C,g=e.R},function(){},function(){},function(){}],execute:function(){const m=[new t("logger",r),new t("rapi-access",c),new t("script-loader",n),new t("camera-control-3d",u),new t("camera-control",p),new t("data-syncer",i),new t("configurator-scene-manager",f,1),new t("configurator-view-model",a,1),new t("component-raycast-helper",d,0)];e("Configurator",class extends o{setupDependencies(){s.setup(m),this.lookup("planner-kernel-access",this._context).init(1),this.lookup("rapi-access",this._context),this.lookup("script-loader",this._context),this.lookup("logger",this._context)}cleanUpGlobals(){delete window.RoomleConfigurator}cleanUpDependencies(){const e=this.lookup("script-loader"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};l.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new g(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
|
|
2
|
+
//# sourceMappingURL=configurator-f6c18b4f.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurator-f6c18b4f.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Configurator}from"./configurator-a432160a.js";import"./script-loader-91c2a731.js";import"./query-params-helper-a271f9dc.js";import"./roomle-dependency-injection-a6b6e5b9.js";import"./main-thread-to-worker-d5d5841d.js";import"./scene-manager-d62ae8cb.js";import"./component-raycast-helper-e2956b00.js";import"./roomle-configurator-e440c1ed.js";import"./default-light-setting-0e777c93.js";(new Configurator).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let o=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-o))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)});
|
|
2
|
+
//# sourceMappingURL=configurator-main-7d317938.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurator-main-7d317938.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./configurator-
|
|
1
|
+
System.register(["./configurator-f6c18b4f.nomodule.js","./script-loader-d6f3f6fd.nomodule.js","./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-e730f5db.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js","./scene-manager-8263aabe.nomodule.js","./component-raycast-helper-4a0456c1.nomodule.js","./roomle-configurator-2fe2645f.nomodule.js","./default-light-setting-e6f7b96c.nomodule.js"],(function(){var e;return{setters:[function(n){e=n.Configurator},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
|
|
2
2
|
//# sourceMappingURL=configurator-main.nomodule.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=continuous-drawing-helper-
|
|
1
|
+
System.register(["./roomle-dependency-injection-e730f5db.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js"],(function(e){var i,t,r,n,s;return{setters:[function(e){i=e.aa},function(e){t=e.aJ,r=e.f,n=e.u,s=e.x}],execute:function(){e("default",class{constructor(){this._currentInnerRadius=0}init(e,i,t){this._drawingGroup=e,this._continuousDrawingManager=i,this._kernelZoomFactor=t,this.update()}update(){this._initCircle(),this._updateCircle()}_initCircle(){if(this._circleMesh)return;const e=70/this._kernelZoomFactor/1e3,i=new t(e,e+e/50,32),c=new r({color:10066329,side:n});this._circleMesh=new s(i,c),this._circleMesh.name="Circle",this._circleMesh.rotation.set(Math.PI/2,0,0),this._circleMesh.visible=this._continuousDrawingManager.shouldShowCircle(),this._drawingGroup.add(this._circleMesh)}_updateCircle(){if(!this._circleMesh)return;const e=70/this._kernelZoomFactor/1e3;if(e!==this._currentInnerRadius){const i=e+e/50;this._circleMesh.geometry=new t(e,i,32)}const r=i(this._continuousDrawingManager.getStartPoint());r.y=5,this._circleMesh.position.copy(r),this._circleMesh.visible=this._continuousDrawingManager.shouldShowCircle(),this._currentInnerRadius=e}setKernelZoomFactor(e){this._kernelZoomFactor=e}endDrawing(){this._drawingGroup.remove(this._circleMesh),this._circleMesh=null}})}}}));
|
|
2
|
+
//# sourceMappingURL=continuous-drawing-helper-07739909.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuous-drawing-helper-07739909.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{aa as convertToTHREE}from"./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=continuous-drawing-helper-
|
|
1
|
+
import{aa as convertToTHREE}from"./roomle-dependency-injection-a6b6e5b9.js";import{aJ as RingGeometry,f as MeshBasicMaterial,u as DoubleSide,x as Mesh}from"./main-thread-to-worker-d5d5841d.js";class ContinuousDrawingHelper{constructor(){this._currentInnerRadius=0}init(e,i,r){this._drawingGroup=e,this._continuousDrawingManager=i,this._kernelZoomFactor=r,this.update()}update(){this._initCircle(),this._updateCircle()}_initCircle(){if(this._circleMesh)return;const e=70/this._kernelZoomFactor/1e3,i=new RingGeometry(e,e+e/50,32),r=new MeshBasicMaterial({color:10066329,side:DoubleSide});this._circleMesh=new Mesh(i,r),this._circleMesh.name="Circle",this._circleMesh.rotation.set(Math.PI/2,0,0),this._circleMesh.visible=this._continuousDrawingManager.shouldShowCircle(),this._drawingGroup.add(this._circleMesh)}_updateCircle(){if(!this._circleMesh)return;const e=70/this._kernelZoomFactor/1e3;if(e!==this._currentInnerRadius){const i=e+e/50;this._circleMesh.geometry=new RingGeometry(e,i,32)}const i=convertToTHREE(this._continuousDrawingManager.getStartPoint());i.y=5,this._circleMesh.position.copy(i),this._circleMesh.visible=this._continuousDrawingManager.shouldShowCircle(),this._currentInnerRadius=e}setKernelZoomFactor(e){this._kernelZoomFactor=e}endDrawing(){this._drawingGroup.remove(this._circleMesh),this._circleMesh=null}}export{ContinuousDrawingHelper as default};
|
|
2
|
+
//# sourceMappingURL=continuous-drawing-helper-2dc3cb40.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuous-drawing-helper-2dc3cb40.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as LightSetting}from"./scene-manager-
|
|
2
|
-
//# sourceMappingURL=default-light-setting-
|
|
1
|
+
import{L as LightSetting}from"./scene-manager-d62ae8cb.js";import{Z as getGUI}from"./roomle-dependency-injection-a6b6e5b9.js";import{D as DirectionalLight,C as Color,V as Vector2,a as Vector3,A as AmbientLight}from"./main-thread-to-worker-d5d5841d.js";class DefaultLightSetting extends LightSetting{constructor(i,t){super(i,t),this._params={ambientLight:{color:"#ffffff"},mainDirLight:{position:{x:-3,y:4,z:4},color:"#ffffff"},secondDirLight:{position:{x:3,y:4,z:3},color:"#ffffff"}},this._mainDirectionalLight=new DirectionalLight(new Color(this._params.mainDirLight.color),.8),this._mainDirectionalLight.position.set(this._params.mainDirLight.position.x,this._params.mainDirLight.position.y,this._params.mainDirLight.position.z),this._mainDirectionalLight.layers.set(1),this._mainDirectionalLight.castShadow=!0,this._mainDirectionalLight.shadow.camera.near=.1,this._mainDirectionalLight.shadow.camera.far=100,this._mainDirectionalLight.shadow.mapSize=new Vector2(1024,1024),this._mainDirectionalLight.visible=!0,this._mainDirectionalLight.lookAt(new Vector3(0,0,0)),this._secondDirectionalLight=new DirectionalLight(new Color(this._params.secondDirLight.color),.2),this._secondDirectionalLight.position.set(this._params.secondDirLight.position.x,this._params.secondDirLight.position.y,this._params.secondDirLight.position.z),this._secondDirectionalLight.layers.set(1),this._secondDirectionalLight.castShadow=!1,this._secondDirectionalLight.shadow.camera.near=.1,this._secondDirectionalLight.shadow.camera.far=100,this._secondDirectionalLight.shadow.mapSize=new Vector2(1024,1024),this._secondDirectionalLight.visible=!0,this._secondDirectionalLight.lookAt(new Vector3(0,0,0)),this._ambientLight=new AmbientLight(new Color(this._params.ambientLight.color),.5),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!0}updateBounds(i){const t=i.getSize(new Vector3),a=Math.max(Math.max(t.x,t.y),t.z)+1,e=a/2;this._mainDirectionalLight.shadow.camera.top=e,this._mainDirectionalLight.shadow.camera.bottom=-e,this._mainDirectionalLight.shadow.camera.left=-e,this._mainDirectionalLight.shadow.camera.right=e,this._mainDirectionalLight.shadow.camera.near=.01,this._mainDirectionalLight.shadow.camera.far=4*a,this._mainDirectionalLight.shadow.camera.updateProjectionMatrix(),this._secondDirectionalLight.shadow.camera.top=e,this._secondDirectionalLight.shadow.camera.bottom=-e,this._secondDirectionalLight.shadow.camera.left=-e,this._secondDirectionalLight.shadow.camera.right=e,this._secondDirectionalLight.shadow.camera.near=.01,this._secondDirectionalLight.shadow.camera.far=4*a,this._secondDirectionalLight.shadow.camera.updateProjectionMatrix()}addToScene(){this._scene.add(this._mainDirectionalLight),this._scene.add(this._secondDirectionalLight),this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._mainDirectionalLight),this._scene.remove(this._secondDirectionalLight),this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let i=getGUI();if(i){if(this._ambientLight){let t=i.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(i=>this._ambientLight.color=new Color(i))}if(this._mainDirectionalLight){let t=i.addFolder("Main Directional Light");t.add(this._mainDirectionalLight,"visible"),t.add(this._mainDirectionalLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirectionalLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(i=>this._mainDirectionalLight.color=new Color(i)),t.add(this._mainDirectionalLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new Vector3(0,0,0))),t.add(this._mainDirectionalLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new Vector3(0,0,0))),t.add(this._mainDirectionalLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new Vector3(0,0,0)))}if(this._secondDirectionalLight){let t=i.addFolder("Second Directional Light");t.add(this._secondDirectionalLight,"visible"),t.add(this._secondDirectionalLight,"intensity").min(0).max(10).step(.1),t.add(this._secondDirectionalLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(i=>this._mainDirectionalLight.color=new Color(i)),t.add(this._secondDirectionalLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new Vector3(0,0,0))),t.add(this._secondDirectionalLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new Vector3(0,0,0))),t.add(this._secondDirectionalLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new Vector3(0,0,0)))}}}}export{DefaultLightSetting as D};
|
|
2
|
+
//# sourceMappingURL=default-light-setting-0e777c93.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-light-setting-0e777c93.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./scene-manager-
|
|
2
|
-
//# sourceMappingURL=default-light-setting-
|
|
1
|
+
System.register(["./scene-manager-8263aabe.nomodule.js","./roomle-dependency-injection-e730f5db.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js"],(function(i){var t,a,e,n,o,s,h;return{setters:[function(i){t=i.L},function(i){a=i.Z},function(i){e=i.D,n=i.C,o=i.V,s=i.a,h=i.A}],execute:function(){i("D",class extends t{constructor(i,t){super(i,t),this._params={ambientLight:{color:"#ffffff"},mainDirLight:{position:{x:-3,y:4,z:4},color:"#ffffff"},secondDirLight:{position:{x:3,y:4,z:3},color:"#ffffff"}},this._mainDirectionalLight=new e(new n(this._params.mainDirLight.color),.8),this._mainDirectionalLight.position.set(this._params.mainDirLight.position.x,this._params.mainDirLight.position.y,this._params.mainDirLight.position.z),this._mainDirectionalLight.layers.set(1),this._mainDirectionalLight.castShadow=!0,this._mainDirectionalLight.shadow.camera.near=.1,this._mainDirectionalLight.shadow.camera.far=100,this._mainDirectionalLight.shadow.mapSize=new o(1024,1024),this._mainDirectionalLight.visible=!0,this._mainDirectionalLight.lookAt(new s(0,0,0)),this._secondDirectionalLight=new e(new n(this._params.secondDirLight.color),.2),this._secondDirectionalLight.position.set(this._params.secondDirLight.position.x,this._params.secondDirLight.position.y,this._params.secondDirLight.position.z),this._secondDirectionalLight.layers.set(1),this._secondDirectionalLight.castShadow=!1,this._secondDirectionalLight.shadow.camera.near=.1,this._secondDirectionalLight.shadow.camera.far=100,this._secondDirectionalLight.shadow.mapSize=new o(1024,1024),this._secondDirectionalLight.visible=!0,this._secondDirectionalLight.lookAt(new s(0,0,0)),this._ambientLight=new h(new n(this._params.ambientLight.color),.5),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!0}updateBounds(i){const t=i.getSize(new s),a=Math.max(Math.max(t.x,t.y),t.z)+1,e=a/2;this._mainDirectionalLight.shadow.camera.top=e,this._mainDirectionalLight.shadow.camera.bottom=-e,this._mainDirectionalLight.shadow.camera.left=-e,this._mainDirectionalLight.shadow.camera.right=e,this._mainDirectionalLight.shadow.camera.near=.01,this._mainDirectionalLight.shadow.camera.far=4*a,this._mainDirectionalLight.shadow.camera.updateProjectionMatrix(),this._secondDirectionalLight.shadow.camera.top=e,this._secondDirectionalLight.shadow.camera.bottom=-e,this._secondDirectionalLight.shadow.camera.left=-e,this._secondDirectionalLight.shadow.camera.right=e,this._secondDirectionalLight.shadow.camera.near=.01,this._secondDirectionalLight.shadow.camera.far=4*a,this._secondDirectionalLight.shadow.camera.updateProjectionMatrix()}addToScene(){this._scene.add(this._mainDirectionalLight),this._scene.add(this._secondDirectionalLight),this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._mainDirectionalLight),this._scene.remove(this._secondDirectionalLight),this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let i=a();if(i){if(this._ambientLight){let t=i.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(i=>this._ambientLight.color=new n(i))}if(this._mainDirectionalLight){let t=i.addFolder("Main Directional Light");t.add(this._mainDirectionalLight,"visible"),t.add(this._mainDirectionalLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirectionalLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(i=>this._mainDirectionalLight.color=new n(i)),t.add(this._mainDirectionalLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._mainDirectionalLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._mainDirectionalLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0)))}if(this._secondDirectionalLight){let t=i.addFolder("Second Directional Light");t.add(this._secondDirectionalLight,"visible"),t.add(this._secondDirectionalLight,"intensity").min(0).max(10).step(.1),t.add(this._secondDirectionalLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(i=>this._mainDirectionalLight.color=new n(i)),t.add(this._secondDirectionalLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._secondDirectionalLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0))),t.add(this._secondDirectionalLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirectionalLight.lookAt(new s(0,0,0)))}}}})}}}));
|
|
2
|
+
//# sourceMappingURL=default-light-setting-e6f7b96c.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-light-setting-e6f7b96c.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -38,6 +38,7 @@ export default class InitData implements Context, CommonInitData, ConfiguratorIn
|
|
|
38
38
|
maxLightSources?: number;
|
|
39
39
|
legacyLight?: boolean;
|
|
40
40
|
restrictionLevel?: number;
|
|
41
|
+
e2e?: boolean;
|
|
41
42
|
offlineSync?: string;
|
|
42
43
|
highlighting?: Enumify<typeof ROOMLE_HIGHLIGHTNG>;
|
|
43
44
|
initialFloorMaterial?: string;
|
|
@@ -209,6 +209,10 @@ export interface CommonInitData {
|
|
|
209
209
|
* restrictionLevel defines visibility of parameters and possible children
|
|
210
210
|
*/
|
|
211
211
|
restrictionLevel?: number;
|
|
212
|
+
/**
|
|
213
|
+
* Can be set to true if started as an end-to-end test. This will disable post-processing
|
|
214
|
+
*/
|
|
215
|
+
e2e?: boolean;
|
|
212
216
|
}
|
|
213
217
|
export interface ConfiguratorInitData {
|
|
214
218
|
/**
|
|
@@ -23,7 +23,7 @@ export default class ImageRenderer {
|
|
|
23
23
|
switchToPlannerSettings(): void;
|
|
24
24
|
switchToConfiguratorSettings(): void;
|
|
25
25
|
static getCameraTargetForBBox(bbox: Box3, spacing?: number): CameraTarget;
|
|
26
|
-
preparePerspectiveImage(scene: Scene, uiScene: Scene, camera: PerspectiveCamera, cameraTarget: CameraTarget, options?: PrepareImageOptions, objectRotation?: number): Promise<Base64Image>;
|
|
26
|
+
preparePerspectiveImage(scene: Scene, uiScene: Scene, camera: PerspectiveCamera, cameraTarget: CameraTarget, options?: PrepareImageOptions, objectRotation?: number, e2e?: boolean): Promise<Base64Image>;
|
|
27
27
|
renderPerspectiveImage(scene: Scene, camera: PerspectiveCamera, cameraTarget: CameraTarget, size?: number): Promise<Base64Image>;
|
|
28
28
|
static placeCameraForPerspectiveImage(camera: PerspectiveCamera, cameraTarget: CameraTarget, angleX: number, angleY: number): void;
|
|
29
29
|
prepareTopImage(scene: Scene, uiScene: Scene, cameraTarget: CameraTarget, options?: PrepareImageOptions): Promise<Base64Image>;
|
|
@@ -4,6 +4,7 @@ import { INPUT_EVENT_TYPE } from '../../../common-core/src/input/input-manager';
|
|
|
4
4
|
import { SELECTION_MODE } from '../utils/selection-handler';
|
|
5
5
|
import SceneEventHandler from '../../../common-core/src/webgl/scene-event-handler';
|
|
6
6
|
import type { PerspectiveCamera, Scene, Vector3 } from 'three';
|
|
7
|
+
import { type Camera } from 'three';
|
|
7
8
|
export declare const enum SCENE_EVENT {
|
|
8
9
|
INTERACTION = 0,
|
|
9
10
|
HOVER_ON = 1,
|
|
@@ -84,4 +85,5 @@ export default class ConfiguratorSceneEventHandler extends SceneEventHandler<Sce
|
|
|
84
85
|
getSelectionMode(): SELECTION_MODE;
|
|
85
86
|
getSelectedRuntimeComponentIds(): number[];
|
|
86
87
|
setCameraMoving(cameraMoving: boolean): void;
|
|
88
|
+
setCamera(camera: Camera): void;
|
|
87
89
|
}
|
|
@@ -133,4 +133,5 @@ export default class ConfiguratorSceneManager extends SceneManager implements Co
|
|
|
133
133
|
protected _onCameraIdle(): boolean;
|
|
134
134
|
protected _onCameraMove(): boolean;
|
|
135
135
|
getComponent(componentRuntimeId: number): KernelComponent;
|
|
136
|
+
cameraControlChanged(): void;
|
|
136
137
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as dispose,_ as __decorate,i as inject,ad as AsyncGuard,ax as AsyncDependencyLoader}from"./roomle-dependency-injection-b38984ab.js";import{O as Object3D,a as Vector3,f as MeshBasicMaterial,u as DoubleSide,bg as MeshPhongMaterial,B as BufferGeometry,x as Mesh,Q as Quaternion,b5 as PlaneGeometry,s as LineBasicMaterial,z as Line,b as BufferAttribute,aH as Line3,aa as Box3}from"./main-thread-to-worker-d5d5841d.js";import{T as TextGeometry}from"./TextGeometry-d25f1fa4.js";const PLANE_MATERIAL="component_dimensioning_plane_material",TEXT_MATERIAL="component_dimensioning_text_material";class TextWithBackground extends Object3D{constructor(e){super(),this._label="",this._parameters={font:null,size:.1,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},this.topDown=!1,this._parameters.font=e,this._position=new Vector3,this._initMaterials(),this._init(),this._update()}_initMaterials(){this._cacheHolder.materialCache.has(PLANE_MATERIAL)?this._planeMaterial=this._cacheHolder.materialCache.get(PLANE_MATERIAL):(this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(PLANE_MATERIAL,this._planeMaterial)),this._cacheHolder.materialCache.has(TEXT_MATERIAL)?this._textMaterial=this._cacheHolder.materialCache.get(TEXT_MATERIAL):(this._textMaterial=new MeshPhongMaterial({color:3618615}),this._cacheHolder.materialCache.set(TEXT_MATERIAL,this._textMaterial))}_init(){let e=new BufferGeometry;this._text=new Mesh(e,this._textMaterial),this._text.userData.ignoreComponentRaycast=!0,this._text.name="text with background text "+this._label,this._plane=new Mesh(e,this._planeMaterial),this._plane.userData.ignoreComponentRaycast=!0,this._plane.name="text with background plane "+this._label,this._textGeometry=new TextGeometry(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this.add(this._text),this.add(this._plane)}update(e,t,i,s){this._position.copy(e),this._dimensioningType=t,this._cameraPosition=s,this._label=i;const n=this._cameraPosition.distanceTo(this._text.position),h=Math.max(.01,n/100),o=Math.max(5e-4,n/5e3);this._parameters.bevelThickness=o,this._parameters.bevelSize=o,this._parameters.size=h,this._textGeometry=new TextGeometry(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this._update()}_update(){if(this.topDown){let e=new Quaternion;e.setFromAxisAngle(new Vector3(-1,0,0),Math.PI/2),this._updateText(this._textGeometry,e,new Vector3)}else if(this._updateText(this._textGeometry,new Quaternion,new Vector3),this._cameraPosition){const e=Math.atan2(this._cameraPosition.x-this._position.x,this._cameraPosition.z-this._position.z);this._text.rotation.y=e,this._plane.rotation.y=e}}_updateText(e,t,i){let s=new Vector3;s.copy(this._position),i.x*=this._getXSign(),s.add(i);let n=e.boundingBox.getSize(new Vector3);e.center(),this._text.position.copy(s),this._text.quaternion.copy(t);let h=new PlaneGeometry(n.x+.02,n.y+.02,32);h.center(),this._plane.geometry=h,this._plane.position.copy(s),this._plane.quaternion.copy(t)}_getXSign(){return!this._cameraPosition||this._cameraPosition.x>=0?1:-1}dispose(){dispose(this)}}__decorate([inject],TextWithBackground.prototype,"_cacheHolder",void 0);class DimensioningHelper{constructor(e){this._cameraPosition=new Vector3,this._textUpdated=!1,this._topDimensions=!1,this._initialized=new AsyncGuard,this._enabled=!1,this._dimensionsVisible=!1,this._creator_=e,this._lineMaterial=new LineBasicMaterial({color:3618615,linewidth:2});let t=new BufferGeometry;this._widthLine=new Line(t,this._lineMaterial),this._widthLine.userData.ignoreComponentRaycast=!0,this._widthLine.name="dimension width line",this._heightLine=new Line(t,this._lineMaterial),this._heightLine.userData.ignoreComponentRaycast=!0,this._heightLine.name="dimension height line",this._depthLine=new Line(t,this._lineMaterial),this._depthLine.userData.ignoreComponentRaycast=!0,this._depthLine.name="dimension depth line",this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),AsyncDependencyLoader.loadFont("static/rubik_regular_sub-2dd2d5cca49018c5.json").then(e=>{this._font=e,this._loaded()})}_loaded(){this.update(!1),this.addToScene(this._scene,this._uiScene),this._initialized.resolve()}_performUpdate(e){this._enabled&&(this._lineBounds||e)&&this._font&&(this._updateHeight(),this._updateWidth(),this._updateDepth())}_updateWidth(){let e=new BufferGeometry,t=this._getWidthEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._widthLine.geometry.dispose(),this._widthLine.geometry=e;let s=t.getCenter(new Vector3);this._widthText||(this._widthText=new TextWithBackground(this._font)),this._widthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.x);this._widthText.update(s,0,n,this._cameraPosition)}_updateHeight(){let e=new BufferGeometry,t=this._getHeightEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._heightLine.geometry.dispose(),this._heightLine.geometry=e;let s=t.getCenter(new Vector3);this._heightText||(this._heightText=new TextWithBackground(this._font)),this._heightText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.y);this._heightText.update(s,1,n,this._cameraPosition)}_updateDepth(){let e=new BufferGeometry,t=this._getDepthEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._depthLine.geometry.dispose(),this._depthLine.geometry=e;let s=t.getCenter(new Vector3);this._depthText||(this._depthText=new TextWithBackground(this._font)),this._depthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.z);this._depthText.update(s,2,n,this._cameraPosition)}updateBounds(e){if(!e)return;this._dimensions=e.getSize(new Vector3),this._lineBounds=e.clone();let t=this._lineBounds.min.y<0?this._lineBounds.min.y:0;t-=.01,this._lineBounds.expandByVector(new Vector3(.05,t,.05)),this._textUpdated=!1,this.update()}update(e=!1){this._enabled&&!this._dimensionsVisible&&(this._dimensionsVisible=!0,this._visibilityChangedCallback()),this._performUpdate(e)}addToScene(e,t){this._widthText&&this._widthLine&&this._heightText&&this._heightLine&&this._heightText&&this._heightLine&&(e.add(this._widthLine),t.add(this._widthText),e.add(this._heightLine),t.add(this._heightText),e.add(this._depthLine),t.add(this._depthText))}removeFromScene(e,t){e.remove(this._widthLine),t.remove(this._widthText),e.remove(this._heightLine),t.remove(this._heightText),e.remove(this._depthLine),t.remove(this._depthText)}_getWidthEdge(){return this._cameraPosition.z>=0?new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z),new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z)):new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z))}_getDepthEdge(){return this._cameraPosition.x>=0?new Line3(new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z)):new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z))}_getHeightEdge(){return this._cameraPosition.x>=0&&this._cameraPosition.z>=0?new Line3(new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z),new Vector3(this._lineBounds.max.x,this._lineBounds.max.y,this._lineBounds.max.z)):this._cameraPosition.x<0&&this._cameraPosition.z>=0?new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z),new Vector3(this._lineBounds.min.x,this._lineBounds.max.y,this._lineBounds.max.z)):this._cameraPosition.x>=0&&this._cameraPosition.z<0?new Line3(new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.max.x,this._lineBounds.max.y,this._lineBounds.min.z)):new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.min.x,this._lineBounds.max.y,this._lineBounds.min.z))}onDimensionsVisibilityChanged(e){this._onChange=e}enableTopDimensions(){this.enableDimensions(),this._topDimensions=!0,this._heightLine.visible=!1,this._heightText.visible=!1,this.update(!0)}disableTopDimensions(){this._topDimensions=!1,this._heightLine.visible=!0,this._heightText.visible=!0,this.disableDimensions()}enableDimensions(){this._enabled=!0,this.update(!0),this.addToScene(this._scene,this._uiScene)}disableDimensions(){this._enabled=!1,this._dimensionsVisible&&(this._dimensionsVisible=!1,this._visibilityChangedCallback()),this.removeFromScene(this._scene,this._uiScene)}_visibilityChangedCallback(){this._onChange&&this._onChange(this._dimensionsVisible)}_clear(){this._lineMaterial.dispose(),this._planeMaterial.dispose(),this._widthLine.geometry.dispose(),this._heightLine.geometry.dispose(),this._depthLine.geometry.dispose(),this._heightText.dispose(),this._heightText.dispose(),this._depthText.dispose()}getBoundingBox(){const e=new Box3;return e.expandByObject(this._widthLine),e.expandByObject(this._widthText),e.expandByObject(this._heightLine),e.expandByObject(this._heightText),e.expandByObject(this._depthLine),e.expandByObject(this._depthText),e}setVisibility(e){this._heightLine&&this._widthLine&&this._depthLine&&this._heightText&&this._widthText&&this._depthText&&(this._heightLine.visible=e,this._heightText.visible=e,this._widthLine.visible=e,this._widthText.visible=e,this._depthLine.visible=e,this._depthText.visible=e)}moveCameraStart(e){this.setVisibility(!1),this._cameraPosition=e,this.update()}moveCameraEnd(e){this.setVisibility(!0),this._cameraPosition=e,this.update()}clearScene(e){this._clear()}setScene(e){this._scene=e}setUiScene(e){this._uiScene=e}needsUiScene(){return!0}isInitialized(){return this._initialized.wait()}areDimensionsEnabled(){return this._enabled}}__decorate([inject],DimensioningHelper.prototype,"_unitFormatter",void 0);export{DimensioningHelper as default};
|
|
2
|
-
//# sourceMappingURL=dimensioning-helper-
|
|
1
|
+
import{s as dispose,_ as __decorate,i as inject,ad as AsyncGuard,ax as AsyncDependencyLoader}from"./roomle-dependency-injection-a6b6e5b9.js";import{O as Object3D,a as Vector3,f as MeshBasicMaterial,u as DoubleSide,bg as MeshPhongMaterial,B as BufferGeometry,x as Mesh,Q as Quaternion,b5 as PlaneGeometry,s as LineBasicMaterial,z as Line,b as BufferAttribute,aH as Line3,aa as Box3}from"./main-thread-to-worker-d5d5841d.js";import{T as TextGeometry}from"./TextGeometry-d25f1fa4.js";const PLANE_MATERIAL="component_dimensioning_plane_material",TEXT_MATERIAL="component_dimensioning_text_material";class TextWithBackground extends Object3D{constructor(e){super(),this._label="",this._parameters={font:null,size:.1,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},this.topDown=!1,this._parameters.font=e,this._position=new Vector3,this._initMaterials(),this._init(),this._update()}_initMaterials(){this._cacheHolder.materialCache.has(PLANE_MATERIAL)?this._planeMaterial=this._cacheHolder.materialCache.get(PLANE_MATERIAL):(this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(PLANE_MATERIAL,this._planeMaterial)),this._cacheHolder.materialCache.has(TEXT_MATERIAL)?this._textMaterial=this._cacheHolder.materialCache.get(TEXT_MATERIAL):(this._textMaterial=new MeshPhongMaterial({color:3618615}),this._cacheHolder.materialCache.set(TEXT_MATERIAL,this._textMaterial))}_init(){let e=new BufferGeometry;this._text=new Mesh(e,this._textMaterial),this._text.userData.ignoreComponentRaycast=!0,this._text.name="text with background text "+this._label,this._plane=new Mesh(e,this._planeMaterial),this._plane.userData.ignoreComponentRaycast=!0,this._plane.name="text with background plane "+this._label,this._textGeometry=new TextGeometry(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this.add(this._text),this.add(this._plane)}update(e,t,i,s){this._position.copy(e),this._dimensioningType=t,this._cameraPosition=s,this._label=i;const n=this._cameraPosition.distanceTo(this._text.position),h=Math.max(.01,n/100),o=Math.max(5e-4,n/5e3);this._parameters.bevelThickness=o,this._parameters.bevelSize=o,this._parameters.size=h,this._textGeometry=new TextGeometry(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this._update()}_update(){if(this.topDown){let e=new Quaternion;e.setFromAxisAngle(new Vector3(-1,0,0),Math.PI/2),this._updateText(this._textGeometry,e,new Vector3)}else if(this._updateText(this._textGeometry,new Quaternion,new Vector3),this._cameraPosition){const e=Math.atan2(this._cameraPosition.x-this._position.x,this._cameraPosition.z-this._position.z);this._text.rotation.y=e,this._plane.rotation.y=e}}_updateText(e,t,i){let s=new Vector3;s.copy(this._position),i.x*=this._getXSign(),s.add(i);let n=e.boundingBox.getSize(new Vector3);e.center(),this._text.position.copy(s),this._text.quaternion.copy(t);let h=new PlaneGeometry(n.x+.02,n.y+.02,32);h.center(),this._plane.geometry=h,this._plane.position.copy(s),this._plane.quaternion.copy(t)}_getXSign(){return!this._cameraPosition||this._cameraPosition.x>=0?1:-1}dispose(){dispose(this)}}__decorate([inject],TextWithBackground.prototype,"_cacheHolder",void 0);class DimensioningHelper{constructor(e){this._cameraPosition=new Vector3,this._textUpdated=!1,this._topDimensions=!1,this._initialized=new AsyncGuard,this._enabled=!1,this._dimensionsVisible=!1,this._creator_=e,this._lineMaterial=new LineBasicMaterial({color:3618615,linewidth:2});let t=new BufferGeometry;this._widthLine=new Line(t,this._lineMaterial),this._widthLine.userData.ignoreComponentRaycast=!0,this._widthLine.name="dimension width line",this._heightLine=new Line(t,this._lineMaterial),this._heightLine.userData.ignoreComponentRaycast=!0,this._heightLine.name="dimension height line",this._depthLine=new Line(t,this._lineMaterial),this._depthLine.userData.ignoreComponentRaycast=!0,this._depthLine.name="dimension depth line",this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),AsyncDependencyLoader.loadFont("static/rubik_regular_sub-2dd2d5cca49018c5.json").then(e=>{this._font=e,this._loaded()})}_loaded(){this.update(!1),this.addToScene(this._scene,this._uiScene),this._initialized.resolve()}_performUpdate(e){this._enabled&&(this._lineBounds||e)&&this._font&&(this._updateHeight(),this._updateWidth(),this._updateDepth())}_updateWidth(){let e=new BufferGeometry,t=this._getWidthEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._widthLine.geometry.dispose(),this._widthLine.geometry=e;let s=t.getCenter(new Vector3);this._widthText||(this._widthText=new TextWithBackground(this._font)),this._widthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.x);this._widthText.update(s,0,n,this._cameraPosition)}_updateHeight(){let e=new BufferGeometry,t=this._getHeightEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._heightLine.geometry.dispose(),this._heightLine.geometry=e;let s=t.getCenter(new Vector3);this._heightText||(this._heightText=new TextWithBackground(this._font)),this._heightText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.y);this._heightText.update(s,1,n,this._cameraPosition)}_updateDepth(){let e=new BufferGeometry,t=this._getDepthEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._depthLine.geometry.dispose(),this._depthLine.geometry=e;let s=t.getCenter(new Vector3);this._depthText||(this._depthText=new TextWithBackground(this._font)),this._depthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.z);this._depthText.update(s,2,n,this._cameraPosition)}updateBounds(e){if(!e)return;this._dimensions=e.getSize(new Vector3),this._lineBounds=e.clone();let t=this._lineBounds.min.y<0?this._lineBounds.min.y:0;t-=.01,this._lineBounds.expandByVector(new Vector3(.05,t,.05)),this._textUpdated=!1,this.update()}update(e=!1){this._enabled&&!this._dimensionsVisible&&(this._dimensionsVisible=!0,this._visibilityChangedCallback()),this._performUpdate(e)}addToScene(e,t){this._widthText&&this._widthLine&&this._heightText&&this._heightLine&&this._heightText&&this._heightLine&&(e.add(this._widthLine),t.add(this._widthText),e.add(this._heightLine),t.add(this._heightText),e.add(this._depthLine),t.add(this._depthText))}removeFromScene(e,t){e.remove(this._widthLine),t.remove(this._widthText),e.remove(this._heightLine),t.remove(this._heightText),e.remove(this._depthLine),t.remove(this._depthText)}_getWidthEdge(){return this._cameraPosition.z>=0?new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z),new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z)):new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z))}_getDepthEdge(){return this._cameraPosition.x>=0?new Line3(new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z)):new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z))}_getHeightEdge(){return this._cameraPosition.x>=0&&this._cameraPosition.z>=0?new Line3(new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z),new Vector3(this._lineBounds.max.x,this._lineBounds.max.y,this._lineBounds.max.z)):this._cameraPosition.x<0&&this._cameraPosition.z>=0?new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z),new Vector3(this._lineBounds.min.x,this._lineBounds.max.y,this._lineBounds.max.z)):this._cameraPosition.x>=0&&this._cameraPosition.z<0?new Line3(new Vector3(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.max.x,this._lineBounds.max.y,this._lineBounds.min.z)):new Line3(new Vector3(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new Vector3(this._lineBounds.min.x,this._lineBounds.max.y,this._lineBounds.min.z))}onDimensionsVisibilityChanged(e){this._onChange=e}enableTopDimensions(){this.enableDimensions(),this._topDimensions=!0,this._heightLine.visible=!1,this._heightText.visible=!1,this.update(!0)}disableTopDimensions(){this._topDimensions=!1,this._heightLine.visible=!0,this._heightText.visible=!0,this.disableDimensions()}enableDimensions(){this._enabled=!0,this.update(!0),this.addToScene(this._scene,this._uiScene)}disableDimensions(){this._enabled=!1,this._dimensionsVisible&&(this._dimensionsVisible=!1,this._visibilityChangedCallback()),this.removeFromScene(this._scene,this._uiScene)}_visibilityChangedCallback(){this._onChange&&this._onChange(this._dimensionsVisible)}_clear(){this._lineMaterial.dispose(),this._planeMaterial.dispose(),this._widthLine.geometry.dispose(),this._heightLine.geometry.dispose(),this._depthLine.geometry.dispose(),this._heightText.dispose(),this._heightText.dispose(),this._depthText.dispose()}getBoundingBox(){const e=new Box3;return e.expandByObject(this._widthLine),e.expandByObject(this._widthText),e.expandByObject(this._heightLine),e.expandByObject(this._heightText),e.expandByObject(this._depthLine),e.expandByObject(this._depthText),e}setVisibility(e){this._heightLine&&this._widthLine&&this._depthLine&&this._heightText&&this._widthText&&this._depthText&&(this._heightLine.visible=e,this._heightText.visible=e,this._widthLine.visible=e,this._widthText.visible=e,this._depthLine.visible=e,this._depthText.visible=e)}moveCameraStart(e){this.setVisibility(!1),this._cameraPosition=e,this.update()}moveCameraEnd(e){this.setVisibility(!0),this._cameraPosition=e,this.update()}clearScene(e){this._clear()}setScene(e){this._scene=e}setUiScene(e){this._uiScene=e}needsUiScene(){return!0}isInitialized(){return this._initialized.wait()}areDimensionsEnabled(){return this._enabled}}__decorate([inject],DimensioningHelper.prototype,"_unitFormatter",void 0);export{DimensioningHelper as default};
|
|
2
|
+
//# sourceMappingURL=dimensioning-helper-9b64c1d3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimensioning-helper-
|
|
1
|
+
{"version":3,"file":"dimensioning-helper-9b64c1d3.js","sources":["../../packages/configurator-core/public/fonts/rubik_regular_sub.json"],"sourcesContent":["export default \"static/rubik_regular_sub-2dd2d5cca49018c5.json\""],"names":[],"mappings":"wnIAAe"}
|
package/lib/{dimensioning-helper-c5a31177.nomodule.js → dimensioning-helper-fe23dfaf.nomodule.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=dimensioning-helper-
|
|
1
|
+
System.register(["./roomle-dependency-injection-e730f5db.nomodule.js","./main-thread-to-worker-cce716d1.nomodule.js","./TextGeometry-f2fc57a2.nomodule.js"],(function(t){var e,i,s,n,h,o,a,_,d,l,r,m,p,x,u,c,g,w,y,b;return{setters:[function(t){e=t.s,i=t._,s=t.i,n=t.ad,h=t.ax},function(t){o=t.O,a=t.a,_=t.f,d=t.u,l=t.bg,r=t.B,m=t.x,p=t.Q,x=t.b5,u=t.s,c=t.z,g=t.b,w=t.aH,y=t.aa},function(t){b=t.T}],execute:function(){const B="component_dimensioning_plane_material",T="component_dimensioning_text_material";class z extends o{constructor(t){super(),this._label="",this._parameters={font:null,size:.1,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},this.topDown=!1,this._parameters.font=t,this._position=new a,this._initMaterials(),this._init(),this._update()}_initMaterials(){this._cacheHolder.materialCache.has(B)?this._planeMaterial=this._cacheHolder.materialCache.get(B):(this._planeMaterial=new _({color:16777215,side:d,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(B,this._planeMaterial)),this._cacheHolder.materialCache.has(T)?this._textMaterial=this._cacheHolder.materialCache.get(T):(this._textMaterial=new l({color:3618615}),this._cacheHolder.materialCache.set(T,this._textMaterial))}_init(){let t=new r;this._text=new m(t,this._textMaterial),this._text.userData.ignoreComponentRaycast=!0,this._text.name="text with background text "+this._label,this._plane=new m(t,this._planeMaterial),this._plane.userData.ignoreComponentRaycast=!0,this._plane.name="text with background plane "+this._label,this._textGeometry=new b(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this.add(this._text),this.add(this._plane)}update(t,e,i,s){this._position.copy(t),this._dimensioningType=e,this._cameraPosition=s,this._label=i;const n=this._cameraPosition.distanceTo(this._text.position),h=Math.max(.01,n/100),o=Math.max(5e-4,n/5e3);this._parameters.bevelThickness=o,this._parameters.bevelSize=o,this._parameters.size=h,this._textGeometry=new b(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this._update()}_update(){if(this.topDown){let t=new p;t.setFromAxisAngle(new a(-1,0,0),Math.PI/2),this._updateText(this._textGeometry,t,new a)}else if(this._updateText(this._textGeometry,new p,new a),this._cameraPosition){const t=Math.atan2(this._cameraPosition.x-this._position.x,this._cameraPosition.z-this._position.z);this._text.rotation.y=t,this._plane.rotation.y=t}}_updateText(t,e,i){let s=new a;s.copy(this._position),i.x*=this._getXSign(),s.add(i);let n=t.boundingBox.getSize(new a);t.center(),this._text.position.copy(s),this._text.quaternion.copy(e);let h=new x(n.x+.02,n.y+.02,32);h.center(),this._plane.geometry=h,this._plane.position.copy(s),this._plane.quaternion.copy(e)}_getXSign(){return!this._cameraPosition||this._cameraPosition.x>=0?1:-1}dispose(){e(this)}}i([s],z.prototype,"_cacheHolder",void 0);class L{constructor(t){this._cameraPosition=new a,this._textUpdated=!1,this._topDimensions=!1,this._initialized=new n,this._enabled=!1,this._dimensionsVisible=!1,this._creator_=t,this._lineMaterial=new u({color:3618615,linewidth:2});let e=new r;this._widthLine=new c(e,this._lineMaterial),this._widthLine.userData.ignoreComponentRaycast=!0,this._widthLine.name="dimension width line",this._heightLine=new c(e,this._lineMaterial),this._heightLine.userData.ignoreComponentRaycast=!0,this._heightLine.name="dimension height line",this._depthLine=new c(e,this._lineMaterial),this._depthLine.userData.ignoreComponentRaycast=!0,this._depthLine.name="dimension depth line",this._planeMaterial=new _({color:16777215,side:d,opacity:.8,transparent:!0}),h.loadFont("static/rubik_regular_sub-2dd2d5cca49018c5.json").then(t=>{this._font=t,this._loaded()})}_loaded(){this.update(!1),this.addToScene(this._scene,this._uiScene),this._initialized.resolve()}_performUpdate(t){this._enabled&&(this._lineBounds||t)&&this._font&&(this._updateHeight(),this._updateWidth(),this._updateDepth())}_updateWidth(){let t=new r,e=this._getWidthEdge(),i=[e.start.x,e.start.y,e.start.z,e.end.x,e.end.y,e.end.z];t.setAttribute("position",new g(new Float32Array(i),3)),this._widthLine.geometry.dispose(),this._widthLine.geometry=t;let s=e.getCenter(new a);this._widthText||(this._widthText=new z(this._font)),this._widthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.x);this._widthText.update(s,0,n,this._cameraPosition)}_updateHeight(){let t=new r,e=this._getHeightEdge(),i=[e.start.x,e.start.y,e.start.z,e.end.x,e.end.y,e.end.z];t.setAttribute("position",new g(new Float32Array(i),3)),this._heightLine.geometry.dispose(),this._heightLine.geometry=t;let s=e.getCenter(new a);this._heightText||(this._heightText=new z(this._font)),this._heightText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.y);this._heightText.update(s,1,n,this._cameraPosition)}_updateDepth(){let t=new r,e=this._getDepthEdge(),i=[e.start.x,e.start.y,e.start.z,e.end.x,e.end.y,e.end.z];t.setAttribute("position",new g(new Float32Array(i),3)),this._depthLine.geometry.dispose(),this._depthLine.geometry=t;let s=e.getCenter(new a);this._depthText||(this._depthText=new z(this._font)),this._depthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.z);this._depthText.update(s,2,n,this._cameraPosition)}updateBounds(t){if(!t)return;this._dimensions=t.getSize(new a),this._lineBounds=t.clone();let e=this._lineBounds.min.y<0?this._lineBounds.min.y:0;e-=.01,this._lineBounds.expandByVector(new a(.05,e,.05)),this._textUpdated=!1,this.update()}update(t=!1){this._enabled&&!this._dimensionsVisible&&(this._dimensionsVisible=!0,this._visibilityChangedCallback()),this._performUpdate(t)}addToScene(t,e){this._widthText&&this._widthLine&&this._heightText&&this._heightLine&&this._heightText&&this._heightLine&&(t.add(this._widthLine),e.add(this._widthText),t.add(this._heightLine),e.add(this._heightText),t.add(this._depthLine),e.add(this._depthText))}removeFromScene(t,e){t.remove(this._widthLine),e.remove(this._widthText),t.remove(this._heightLine),e.remove(this._heightText),t.remove(this._depthLine),e.remove(this._depthText)}_getWidthEdge(){return this._cameraPosition.z>=0?new w(new a(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z),new a(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z)):new w(new a(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new a(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z))}_getDepthEdge(){return this._cameraPosition.x>=0?new w(new a(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z),new a(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z)):new w(new a(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new a(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z))}_getHeightEdge(){return this._cameraPosition.x>=0&&this._cameraPosition.z>=0?new w(new a(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.max.z),new a(this._lineBounds.max.x,this._lineBounds.max.y,this._lineBounds.max.z)):this._cameraPosition.x<0&&this._cameraPosition.z>=0?new w(new a(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.max.z),new a(this._lineBounds.min.x,this._lineBounds.max.y,this._lineBounds.max.z)):this._cameraPosition.x>=0&&this._cameraPosition.z<0?new w(new a(this._lineBounds.max.x,this._lineBounds.min.y,this._lineBounds.min.z),new a(this._lineBounds.max.x,this._lineBounds.max.y,this._lineBounds.min.z)):new w(new a(this._lineBounds.min.x,this._lineBounds.min.y,this._lineBounds.min.z),new a(this._lineBounds.min.x,this._lineBounds.max.y,this._lineBounds.min.z))}onDimensionsVisibilityChanged(t){this._onChange=t}enableTopDimensions(){this.enableDimensions(),this._topDimensions=!0,this._heightLine.visible=!1,this._heightText.visible=!1,this.update(!0)}disableTopDimensions(){this._topDimensions=!1,this._heightLine.visible=!0,this._heightText.visible=!0,this.disableDimensions()}enableDimensions(){this._enabled=!0,this.update(!0),this.addToScene(this._scene,this._uiScene)}disableDimensions(){this._enabled=!1,this._dimensionsVisible&&(this._dimensionsVisible=!1,this._visibilityChangedCallback()),this.removeFromScene(this._scene,this._uiScene)}_visibilityChangedCallback(){this._onChange&&this._onChange(this._dimensionsVisible)}_clear(){this._lineMaterial.dispose(),this._planeMaterial.dispose(),this._widthLine.geometry.dispose(),this._heightLine.geometry.dispose(),this._depthLine.geometry.dispose(),this._heightText.dispose(),this._heightText.dispose(),this._depthText.dispose()}getBoundingBox(){const t=new y;return t.expandByObject(this._widthLine),t.expandByObject(this._widthText),t.expandByObject(this._heightLine),t.expandByObject(this._heightText),t.expandByObject(this._depthLine),t.expandByObject(this._depthText),t}setVisibility(t){this._heightLine&&this._widthLine&&this._depthLine&&this._heightText&&this._widthText&&this._depthText&&(this._heightLine.visible=t,this._heightText.visible=t,this._widthLine.visible=t,this._widthText.visible=t,this._depthLine.visible=t,this._depthText.visible=t)}moveCameraStart(t){this.setVisibility(!1),this._cameraPosition=t,this.update()}moveCameraEnd(t){this.setVisibility(!0),this._cameraPosition=t,this.update()}clearScene(t){this._clear()}setScene(t){this._scene=t}setUiScene(t){this._uiScene=t}needsUiScene(){return!0}isInitialized(){return this._initialized.wait()}areDimensionsEnabled(){return this._enabled}}t("default",L),i([s],L.prototype,"_unitFormatter",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=dimensioning-helper-fe23dfaf.nomodule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimensioning-helper-
|
|
1
|
+
{"version":3,"file":"dimensioning-helper-fe23dfaf.nomodule.js","sources":["../../packages/configurator-core/public/fonts/rubik_regular_sub.json"],"sourcesContent":["export default \"static/rubik_regular_sub-2dd2d5cca49018c5.json\""],"names":[],"mappings":"6oHAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as ScriptLoader,M as Main}from"./script-loader-c9998e7d.js";import{an as InputManager,D as DependencyInjectionAssignment,L as Logger,R as RapiAccess,Z as getGUI,_ as __decorate,i as inject,l as CANVAS_ID,p as DynamicLightSettingLoader,q as PREDEFINED_LIGHTSETTING,s as dispose,b as RoomleDependencyInjection}from"./roomle-dependency-injection-b38984ab.js";import{C as CameraControl3D,L as LightSetting,S as SceneManager,T as TWEEN_FILE_NAME}from"./scene-manager-d05d913f.js";import{a as Vector3,aa as Box3,ae as Euler,Q as Quaternion,A as AmbientLight,C as Color,av as getGlbUrl,bu as WebGLRenderer,h as SRGBColorSpace,bc as BasicShadowMap,J as PerspectiveCamera,bJ as download}from"./main-thread-to-worker-d5d5841d.js";import{D as DefaultLightSetting}from"./default-light-setting-1bc01b3d.js";import"./query-params-helper-a271f9dc.js";const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("glb-input-manager",class extends InputManager{},1),new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("rapi-access",RapiAccess)];class AdjustableCameraControl3D extends CameraControl3D{constructor(){super(...arguments),this.shouldIgnoreStandardBehavior=!1}adjust(e,t,r,i,n){let s=new Vector3(-e.x/2,0,-e.z/2),a=new Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new Box3(s,a);let o=new Euler(-Math.PI/2+i,r,0,"ZYX"),c=(new Quaternion).setFromEuler(o);this._camera.updateProjectionMatrix(),this._camera.quaternion.copy(c),this._camera.position.copy(t)}_update(e){this.shouldIgnoreStandardBehavior?this._saveYawAndPitch():super._update(e)}animateCamera(e){return!!this.shouldIgnoreStandardBehavior||super.animateCamera(e)}}class GLBViewerLightSetting extends LightSetting{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new AmbientLight(new Color(this._params.ambientLight.color),.5),this.addToScene()}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>{this._ambientLight.color=new Color(e)})}}}class GLBViewerSceneManager extends SceneManager{constructor(e,t){super(e,t,CANVAS_ID.GLB),this._itemsCount=0,this._standardSceneBackgroundColor=this._scene.background,this._initData.legacyLight&&(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)):(console.warn("this device has a maximum of 8 texture units thus we are using a simpler light setting"),this._lightSetting=new GLBViewerLightSetting(this._scene)))}createCameraControl(e,t){this._cameraControl=new AdjustableCameraControl3D(this._creator_,this._getInputManager(),new Vector3(-1,1,1))}_getInputManager(){return this._glbInputManager}async loadStaticItem(e,t){const r=await this._rapiAccess.getItem(e);if(r.configuration)return Promise.reject();const i=getGlbUrl(r);return i?this.loadGLB(i,!0,void 0,t):Promise.reject(new Error("GLB Url not detected"))}loadGLB(e,t=!0,r=new Vector3(1,1,1),i){return this.clearScene(),new Promise((n,s)=>{this._loadGLB(e,new Vector3(0,0,0),0,void 0,r,void 0,void 0,i).then(e=>{this._currentGLB=e,this._scene.add(this._currentGLB);let r=(new Box3).setFromObject(this._currentGLB);if(t){let e=r.getCenter(new Vector3);this._cameraControl instanceof AdjustableCameraControl3D&&(this._cameraControl.updateToBounds(r,!1,!0,e),this._cameraControl.reset(r,e,-15,0))}this._updateBounds(r,!0),n()},s)})}preparePerspectiveImage(e,t,r){return new Promise(i=>{t||(t=1e3),r||(r=1e3),e||((e=new WebGLRenderer({antialias:!0})).setSize(t,r),e.outputColorSpace=SRGBColorSpace,e.autoClear=!1,e.shadowMap.enabled=!0,e.shadowMap.type=BasicShadowMap);let n=this._cameraControl.getCamera().clone();n instanceof PerspectiveCamera&&(n.aspect=t/r,n.updateProjectionMatrix()),this._lightSetting.removeFromScene();let s=new DefaultLightSetting(this._scene);e.render(this._scene,n);let a=e.domElement.toDataURL();e.domElement.toBlob(e=>{i({image:a,width:t,height:r,blob:e})},"image/png"),s.removeFromScene(),this._lightSetting.addToScene()})}adjustCamera(e,t,r,i){if(this._cameraControl instanceof AdjustableCameraControl3D){let n=(new Box3).setFromObject(this._scene).getSize(new Vector3);this._cameraControl.adjust(n,e,t,r,i),this._requestRender()}}onStart(e){this._itemsCount=e,this._scene.background=null,this._cameraControl instanceof AdjustableCameraControl3D&&(this._cameraControl.shouldIgnoreStandardBehavior=!0)}onElementFinished(e){this._itemsCount,Math.round(100/this._itemsCount*e)}onFinished(e){this._scene.background=this._standardSceneBackgroundColor,this._cameraControl instanceof AdjustableCameraControl3D&&(this._cameraControl.shouldIgnoreStandardBehavior=!1)}clearScene(){this._currentGLB&&(this._scene.remove(this._currentGLB),dispose(this._currentGLB),this._currentGLB=null),super.clearScene()}enableHD(){super.enableHD()}sceneChanged(){}getBounds(){return this._currentGLB?(new Box3).setFromObject(this._currentGLB):null}}__decorate([inject],GLBViewerSceneManager.prototype,"_glbInputManager",void 0),__decorate([inject],GLBViewerSceneManager.prototype,"_rapiAccess",void 0);class GLBRenderWorker{constructor(e,t,r){this._prefix="https://furniture.roomle.com/3d/glb/",this._listeners=new Set,this._finishedItems=0,this._sceneManager=e,this._renderer=new WebGLRenderer({antialias:!0,alpha:!0}),this._width=t,this._height=r,this._renderer.setSize(t,r),this._renderer.setClearColor(16777215,0),this._renderer.outputColorSpace=SRGBColorSpace}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}start(e){return this._entries=[],e.forEach(e=>{this._entries.push(this._transform(e))}),this._finishedItems=0,this._listeners.forEach(e=>e.onStart(this._entries.length)),this._zip=new window.JSZip,this._doNextEntry(),new Promise(e=>{this._resolve=e})}_transform(e){return{name:e.path.replace(".glb",".png"),url:this._prefix+e.path,position:new Vector3(e.camera.position.x,e.camera.position.z,-e.camera.position.y),fov:2*e.camera.fieldOfView,yaw:e.camera.rotation.z,pitch:e.camera.rotation.x}}_doNextEntry(){0===this._entries.length?(this._listeners.forEach(e=>e.onFinished(this._zip)),this._resolve(this._zip)):this._processEntry(this._entries[0])}_processEntry(e){this._sceneManager.loadGLB(e.url,!1,void 0).then(()=>{this._sceneManager.adjustCamera(e.position,e.yaw,e.pitch,e.fov),this._sceneManager.preparePerspectiveImage(this._renderer,this._width,this._height).then(t=>{this._entryFinished(e,t)})})}_entryFinished(e,t){let r=this._entries.indexOf(e);r>-1&&this._entries.splice(r,1),this._finishedItems++,this._listeners.forEach(e=>e.onElementFinished(this._finishedItems)),this._zip.file(e.name,t.blob),this._doNextEntry()}}class RoomleGLBViewer{constructor(e){this._currentIdOrUrl=null,this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e,t){return this.setOverrides(t),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})]).then(()=>{this._sceneManager=new GLBViewerSceneManager(this._creator_,{left:0,top:1,right:1,bottom:0}),this._sceneManager.enableHD(),e()})}clearScene(){this._sceneManager.clearScene()}loadGLB(e,t=1,r){return this._currentIdOrUrl=e,this._rapiAccess.trackView(e),this._sceneManager.loadGLB(e,!0,new Vector3(t,t,t),r)}loadStaticItem(e,t){return this._currentIdOrUrl=e,this._rapiAccess.trackView(e),this._sceneManager.loadStaticItem(e,t)}getCurrentId(){return this._currentIdOrUrl}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}preparePerspectiveImage(){return this._sceneManager.preparePerspectiveImage()}processRenderList(e,t=320,r=320){let i=JSON.parse(e);this._scriptLoader.fetch("static/jszip.min-c96375d50e72b199.js",{id:"jszip-js"}).then(()=>{let e=new GLBRenderWorker(this._sceneManager,t,r);e.addListener(this._sceneManager),e.start(i.items).then(t=>{t.generateAsync({type:"blob"}).then(t=>{download("content.zip",URL.createObjectURL(t)),e.removeListener(this._sceneManager)})})})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}get callbacks(){return{}}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getUnitFormatter(){return this._unitFormatter}setEnvironmentMap(e){const{url:t,intensity:r,rotation:i,maxLightSources:n}=e;this._sceneManager.setEnvironmentMap(t,r,i,n)}}__decorate([inject],RoomleGLBViewer.prototype,"_rapiAccess",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_domHelper",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_scriptLoader",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_lifeCycleManager",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_initData",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_globalInitData",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_unitFormatter",void 0);class GlbViewer extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new RoomleGLBViewer(this._context),window.RoomleGLBViewer||(window.RoomleGLBViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"glb-viewer"}}export{GlbViewer};
|
|
2
|
-
//# sourceMappingURL=glb-viewer-
|
|
1
|
+
import{S as ScriptLoader,M as Main}from"./script-loader-91c2a731.js";import{an as InputManager,D as DependencyInjectionAssignment,L as Logger,R as RapiAccess,Z as getGUI,_ as __decorate,i as inject,l as CANVAS_ID,p as DynamicLightSettingLoader,q as PREDEFINED_LIGHTSETTING,s as dispose,b as RoomleDependencyInjection}from"./roomle-dependency-injection-a6b6e5b9.js";import{C as CameraControl3D,L as LightSetting,S as SceneManager,T as TWEEN_FILE_NAME}from"./scene-manager-d62ae8cb.js";import{a as Vector3,aa as Box3,ae as Euler,Q as Quaternion,A as AmbientLight,C as Color,av as getGlbUrl,bu as WebGLRenderer,h as SRGBColorSpace,bc as BasicShadowMap,J as PerspectiveCamera,bJ as download}from"./main-thread-to-worker-d5d5841d.js";import{D as DefaultLightSetting}from"./default-light-setting-0e777c93.js";import"./query-params-helper-a271f9dc.js";const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("glb-input-manager",class extends InputManager{},1),new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("rapi-access",RapiAccess)];class AdjustableCameraControl3D extends CameraControl3D{constructor(){super(...arguments),this.shouldIgnoreStandardBehavior=!1}adjust(e,t,r,i,n){let s=new Vector3(-e.x/2,0,-e.z/2),a=new Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new Box3(s,a);let o=new Euler(-Math.PI/2+i,r,0,"ZYX"),c=(new Quaternion).setFromEuler(o);this._camera.updateProjectionMatrix(),this._camera.quaternion.copy(c),this._camera.position.copy(t)}_update(e){this.shouldIgnoreStandardBehavior?this._saveYawAndPitch():super._update(e)}animateCamera(e){return!!this.shouldIgnoreStandardBehavior||super.animateCamera(e)}}class GLBViewerLightSetting extends LightSetting{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new AmbientLight(new Color(this._params.ambientLight.color),.5),this.addToScene()}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>{this._ambientLight.color=new Color(e)})}}}class GLBViewerSceneManager extends SceneManager{constructor(e,t){super(e,t,CANVAS_ID.GLB),this._itemsCount=0,this._standardSceneBackgroundColor=this._scene.background,this._initData.legacyLight&&(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)):(console.warn("this device has a maximum of 8 texture units thus we are using a simpler light setting"),this._lightSetting=new GLBViewerLightSetting(this._scene)))}createCameraControl(e,t){this._cameraControl=new AdjustableCameraControl3D(this._creator_,this._getInputManager(),new Vector3(-1,1,1))}_getInputManager(){return this._glbInputManager}async loadStaticItem(e,t){const r=await this._rapiAccess.getItem(e);if(r.configuration)return Promise.reject();const i=getGlbUrl(r);return i?this.loadGLB(i,!0,void 0,t):Promise.reject(new Error("GLB Url not detected"))}loadGLB(e,t=!0,r=new Vector3(1,1,1),i){return this.clearScene(),new Promise((n,s)=>{this._loadGLB(e,new Vector3(0,0,0),0,void 0,r,void 0,void 0,i).then(e=>{this._currentGLB=e,this._scene.add(this._currentGLB);let r=(new Box3).setFromObject(this._currentGLB);if(t){let e=r.getCenter(new Vector3);this._cameraControl instanceof AdjustableCameraControl3D&&(this._cameraControl.updateToBounds(r,!1,!0,e),this._cameraControl.reset(r,e,-15,0))}this._updateBounds(r,!0),n()},s)})}preparePerspectiveImage(e,t,r){return new Promise(i=>{t||(t=1e3),r||(r=1e3),e||((e=new WebGLRenderer({antialias:!0})).setSize(t,r),e.outputColorSpace=SRGBColorSpace,e.autoClear=!1,e.shadowMap.enabled=!0,e.shadowMap.type=BasicShadowMap);let n=this._cameraControl.getCamera().clone();n instanceof PerspectiveCamera&&(n.aspect=t/r,n.updateProjectionMatrix()),this._lightSetting.removeFromScene();let s=new DefaultLightSetting(this._scene);e.render(this._scene,n);let a=e.domElement.toDataURL();e.domElement.toBlob(e=>{i({image:a,width:t,height:r,blob:e})},"image/png"),s.removeFromScene(),this._lightSetting.addToScene()})}adjustCamera(e,t,r,i){if(this._cameraControl instanceof AdjustableCameraControl3D){let n=(new Box3).setFromObject(this._scene).getSize(new Vector3);this._cameraControl.adjust(n,e,t,r,i),this._requestRender()}}onStart(e){this._itemsCount=e,this._scene.background=null,this._cameraControl instanceof AdjustableCameraControl3D&&(this._cameraControl.shouldIgnoreStandardBehavior=!0)}onElementFinished(e){this._itemsCount,Math.round(100/this._itemsCount*e)}onFinished(e){this._scene.background=this._standardSceneBackgroundColor,this._cameraControl instanceof AdjustableCameraControl3D&&(this._cameraControl.shouldIgnoreStandardBehavior=!1)}clearScene(){this._currentGLB&&(this._scene.remove(this._currentGLB),dispose(this._currentGLB),this._currentGLB=null),super.clearScene()}enableHD(){super.enableHD()}sceneChanged(){}getBounds(){return this._currentGLB?(new Box3).setFromObject(this._currentGLB):null}}__decorate([inject],GLBViewerSceneManager.prototype,"_glbInputManager",void 0),__decorate([inject],GLBViewerSceneManager.prototype,"_rapiAccess",void 0);class GLBRenderWorker{constructor(e,t,r){this._prefix="https://furniture.roomle.com/3d/glb/",this._listeners=new Set,this._finishedItems=0,this._sceneManager=e,this._renderer=new WebGLRenderer({antialias:!0,alpha:!0}),this._width=t,this._height=r,this._renderer.setSize(t,r),this._renderer.setClearColor(16777215,0),this._renderer.outputColorSpace=SRGBColorSpace}addListener(e){this._listeners.add(e)}removeListener(e){this._listeners.delete(e)}start(e){return this._entries=[],e.forEach(e=>{this._entries.push(this._transform(e))}),this._finishedItems=0,this._listeners.forEach(e=>e.onStart(this._entries.length)),this._zip=new window.JSZip,this._doNextEntry(),new Promise(e=>{this._resolve=e})}_transform(e){return{name:e.path.replace(".glb",".png"),url:this._prefix+e.path,position:new Vector3(e.camera.position.x,e.camera.position.z,-e.camera.position.y),fov:2*e.camera.fieldOfView,yaw:e.camera.rotation.z,pitch:e.camera.rotation.x}}_doNextEntry(){0===this._entries.length?(this._listeners.forEach(e=>e.onFinished(this._zip)),this._resolve(this._zip)):this._processEntry(this._entries[0])}_processEntry(e){this._sceneManager.loadGLB(e.url,!1,void 0).then(()=>{this._sceneManager.adjustCamera(e.position,e.yaw,e.pitch,e.fov),this._sceneManager.preparePerspectiveImage(this._renderer,this._width,this._height).then(t=>{this._entryFinished(e,t)})})}_entryFinished(e,t){let r=this._entries.indexOf(e);r>-1&&this._entries.splice(r,1),this._finishedItems++,this._listeners.forEach(e=>e.onElementFinished(this._finishedItems)),this._zip.file(e.name,t.blob),this._doNextEntry()}}class RoomleGLBViewer{constructor(e){this._currentIdOrUrl=null,this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e,t){return this.setOverrides(t),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})]).then(()=>{this._sceneManager=new GLBViewerSceneManager(this._creator_,{left:0,top:1,right:1,bottom:0}),this._sceneManager.enableHD(),e()})}clearScene(){this._sceneManager.clearScene()}loadGLB(e,t=1,r){return this._currentIdOrUrl=e,this._rapiAccess.trackView(e),this._sceneManager.loadGLB(e,!0,new Vector3(t,t,t),r)}loadStaticItem(e,t){return this._currentIdOrUrl=e,this._rapiAccess.trackView(e),this._sceneManager.loadStaticItem(e,t)}getCurrentId(){return this._currentIdOrUrl}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}preparePerspectiveImage(){return this._sceneManager.preparePerspectiveImage()}processRenderList(e,t=320,r=320){let i=JSON.parse(e);this._scriptLoader.fetch("static/jszip.min-c96375d50e72b199.js",{id:"jszip-js"}).then(()=>{let e=new GLBRenderWorker(this._sceneManager,t,r);e.addListener(this._sceneManager),e.start(i.items).then(t=>{t.generateAsync({type:"blob"}).then(t=>{download("content.zip",URL.createObjectURL(t)),e.removeListener(this._sceneManager)})})})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}get callbacks(){return{}}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getUnitFormatter(){return this._unitFormatter}setEnvironmentMap(e){const{url:t,intensity:r,rotation:i,maxLightSources:n}=e;this._sceneManager.setEnvironmentMap(t,r,i,n)}}__decorate([inject],RoomleGLBViewer.prototype,"_rapiAccess",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_domHelper",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_scriptLoader",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_lifeCycleManager",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_initData",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_globalInitData",void 0),__decorate([inject],RoomleGLBViewer.prototype,"_unitFormatter",void 0);class GlbViewer extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new RoomleGLBViewer(this._context),window.RoomleGLBViewer||(window.RoomleGLBViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"glb-viewer"}}export{GlbViewer};
|
|
2
|
+
//# sourceMappingURL=glb-viewer-9a11a5b0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glb-viewer-
|
|
1
|
+
{"version":3,"file":"glb-viewer-9a11a5b0.js","sources":["../../node_modules/jszip/dist/jszip.min.js"],"sourcesContent":["export default \"static/jszip.min-c96375d50e72b199.js\""],"names":[],"mappings":"6hQAAe"}
|