@eturnity/eturnity_3d 6.43.0 → 6.44.1

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/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * elisee.reclus@eturnity.com
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "6.43.0",
4
+ "version": "6.44.1",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -10,7 +10,7 @@
10
10
  "prettier": "prettier --write \"**/*.{js,vue}\""
11
11
  },
12
12
  "dependencies": {
13
- "@eturnity/eturnity_maths": "6.43.0",
13
+ "@eturnity/eturnity_maths": "6.44.1",
14
14
  "axios": "^1.3.2",
15
15
  "core-js": "^2.6.12",
16
16
  "cors": "^2.8.5",
@@ -34,7 +34,7 @@ export default {
34
34
  1,
35
35
  1000
36
36
  ),
37
- layers:null,
37
+ layers: null,
38
38
  provider: null,
39
39
  cameraProjection: null,
40
40
  texture: null,
@@ -60,9 +60,13 @@ export default {
60
60
  camera: false
61
61
  },
62
62
  screenshotable: false,
63
- areModuleFieldsVisible: false
63
+ areModuleFieldsVisible: false,
64
+ intervalId: null
64
65
  }
65
66
  },
67
+ beforeDestroy() {
68
+ clearInterval(this.intervalId)
69
+ },
66
70
  mixins: [renderMixin, threeMixin, materialMixin],
67
71
  async mounted() {
68
72
  await this.hydrateData(this.geometryData)
@@ -73,33 +77,45 @@ export default {
73
77
  this.initialiseThreeMap()
74
78
  await this.loadPanelsTexture()
75
79
  this.renderGeometry()
76
- if(!this.isBuildingVisible){
77
- Object.values(this.meshes.roofMeshes).forEach(mesh=>mesh.visible=false)
78
- Object.values(this.meshes.baseMeshes).forEach(mesh=>mesh.visible=false)
79
- Object.values(this.meshes.obstacleMeshes).forEach(mesh=>mesh.visible=false)
80
- Object.values(this.meshes.edgeMeshes).forEach(mesh=>mesh.visible=false)
81
- Object.values(this.meshes.panelsMeshes).forEach(mesh=>mesh.visible=false)
80
+ if (!this.isBuildingVisible) {
81
+ Object.values(this.meshes.roofMeshes).forEach(
82
+ (mesh) => (mesh.visible = false)
83
+ )
84
+ Object.values(this.meshes.baseMeshes).forEach(
85
+ (mesh) => (mesh.visible = false)
86
+ )
87
+ Object.values(this.meshes.obstacleMeshes).forEach(
88
+ (mesh) => (mesh.visible = false)
89
+ )
90
+ Object.values(this.meshes.edgeMeshes).forEach(
91
+ (mesh) => (mesh.visible = false)
92
+ )
93
+ Object.values(this.meshes.panelsMeshes).forEach(
94
+ (mesh) => (mesh.visible = false)
95
+ )
82
96
  this.hideMesh(this.mergedBaseMesh)
83
97
  this.hideMesh(this.mergedRoofMesh)
84
98
  this.hideMesh(this.mergedObstacleMesh)
85
99
  this.hideMesh(this.mergedObstacleSideMesh)
86
100
  this.hidePanels()
87
-
88
101
  }
89
- Object.values(this.meshes.flatRoofMeshes).forEach(mesh=>mesh.visible=false)
90
- Object.values(this.meshes.edgeMeshes).forEach(mesh=>mesh.visible=false)
102
+ Object.values(this.meshes.flatRoofMeshes).forEach(
103
+ (mesh) => (mesh.visible = false)
104
+ )
105
+ Object.values(this.meshes.edgeMeshes).forEach(
106
+ (mesh) => (mesh.visible = false)
107
+ )
91
108
  this.onWindowResize()
92
- this.updateProjectionMaterials()
93
109
  this.$root.$on('on-roofSelected', (polygon) =>
94
110
  this.setCameraOrthogonalTo(polygon)
95
111
  )
96
- this.initializeProjectionMaterial()
112
+ await this.updateProjectionMaterials()
97
113
 
98
114
  const polygon = this.polygons.find((p) => p.id == this.uuid)
99
115
  this.setCamera(polygon, this.view_mode)
100
116
  this.isReady.geometry = true
101
117
  this.render()
102
- //this.animate()
118
+ this.intervalId = setInterval(() => this.render(), 500)
103
119
  },
104
120
  computed: {
105
121
  ...mapState({
@@ -108,7 +124,7 @@ export default {
108
124
  view_mode: (state) => state.threeDModule.view_mode,
109
125
  isInteractive: (state) => state.threeDModule.isInteractive,
110
126
  isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
111
- imageOverlay: (state) => state.threeDModule.imageOverlay,
127
+ imageOverlay: (state) => state.threeDModule.imageOverlay
112
128
  }),
113
129
  ...mapGetters({
114
130
  polygons: 'getPolygons',
@@ -132,8 +148,8 @@ export default {
132
148
  setModuleTextureVersionId: 'mutate_moduleTextureVersionId',
133
149
  setSelectedMapLayer: 'mutate_selectedMapLayer'
134
150
  }),
135
- hideMesh(mesh){
136
- if(mesh){
151
+ hideMesh(mesh) {
152
+ if (mesh) {
137
153
  mesh.visible = false
138
154
  }
139
155
  },
@@ -223,7 +239,7 @@ export default {
223
239
  horizontalVector.y = 1
224
240
  }
225
241
  horizontalVector = normalizeVector(horizontalVector)
226
-
242
+
227
243
  cameraMoveVector = multiplyVector(distance * 1000, horizontalVector)
228
244
  }
229
245
 
@@ -44,11 +44,14 @@ export default {
44
44
  opacity: node3dOpacity,
45
45
  transparent: true
46
46
  })
47
-
47
+
48
48
  this.material.panel = {}
49
49
 
50
50
  for (let k = 0; k < defaultTextureUrls.length; k++) {
51
- let texture = this.loader.load(defaultTextureUrls[k], function (texture) {})
51
+ const texture = this.loader.load(
52
+ defaultTextureUrls[k],
53
+ function (texture) {}
54
+ )
52
55
  this.material.panel['default_' + k] = new THREE.MeshBasicMaterial({
53
56
  map: texture,
54
57
  side: THREE.DoubleSide
@@ -10,11 +10,11 @@ export default {
10
10
  if (!component.texture_img_url) {
11
11
  this.material.panel[pvId] = this.material.panel.default
12
12
  } else {
13
- let texture = this.loader.load(component.texture_img_url)
13
+ const texture = this.loader.load(component.texture_img_url)
14
14
  this.material.panel[pvId] = new THREE.MeshBasicMaterial({
15
15
  map: texture,
16
16
  side: THREE.FrontSide,
17
- transparent: false,
17
+ transparent: false
18
18
  })
19
19
  }
20
20
  }
@@ -26,13 +26,18 @@ export default {
26
26
  const pvId = mf.data.component_id_pv_module
27
27
  if (!this.material.panel[pvId]) {
28
28
  if (!mf.data.texture_img_url) {
29
- this.material.panel[pvId] = this.material.panel.default
29
+ this.material.panel[pvId] =
30
+ this.material.panel[`default_${this.moduleTextureVersionId}`]
30
31
  } else {
31
- let texture = await this.loader.load(mf.data.texture_img_url)
32
- this.material.panel[pvId] = new THREE.MeshBasicMaterial({
33
- map: texture,
34
- side: THREE.FrontSide,
35
- transparent: false,
32
+ await new Promise((resolve) => {
33
+ this.loader.load(mf.data.texture_img_url, (texture) => {
34
+ this.material.panel[pvId] = new THREE.MeshBasicMaterial({
35
+ map: texture,
36
+ side: THREE.FrontSide,
37
+ transparent: false
38
+ })
39
+ resolve(texture)
40
+ })
36
41
  })
37
42
  }
38
43
  }
@@ -80,7 +80,6 @@ export default {
80
80
  material = this.material.panel[materialId]
81
81
  }
82
82
  }
83
-
84
83
  if (
85
84
  !this.meshes.panelsMeshes[panelPolygon.id + '_top'] ||
86
85
  !this.meshes.panelsMeshes[panelPolygon.id + '_side']
@@ -75,8 +75,8 @@ export default {
75
75
  return geometry
76
76
  },
77
77
 
78
- applyTextureOnRoofs(){
79
- const material=this.material.roof
78
+ applyTextureOnRoofs() {
79
+ const material = this.material.roof
80
80
  this.reorderRoofMaterials()
81
81
  if (this.mergedRoofMesh) {
82
82
  this.applyTextureOnMesh(material, this.mergedRoofMesh)
@@ -11,7 +11,7 @@ export default {
11
11
  //lastTic:(new Date()).getTime()
12
12
  lastGeometryEventIdDone: -1,
13
13
  backgroundImagesizeInMm: null,
14
- meshes : {
14
+ meshes: {
15
15
  baseMeshes: {},
16
16
  roofMeshes: {},
17
17
  flatRoofMeshes: {},
@@ -25,8 +25,7 @@ export default {
25
25
  }
26
26
  }
27
27
  },
28
- created() {
29
- },
28
+ created() {},
30
29
  computed: {
31
30
  ...mapState({
32
31
  moduleTextureVersionId: (state) =>
@@ -317,7 +316,6 @@ export default {
317
316
  this.renderModuleFields()
318
317
  this.renderPanels()
319
318
  this.renderRoofsMargin()
320
- this.updateProjectionMaterials()
321
319
  },
322
320
  renderBuilding() {
323
321
  this.renderBase()
@@ -328,10 +326,6 @@ export default {
328
326
  this.renderFlatRoofs()
329
327
  },
330
328
 
331
- async initializeProjectionMaterial() {
332
- await this.updateProjectionMaterials()
333
- },
334
-
335
329
  getCanvasOffset() {
336
330
  if (!this.$refs.canvas3DContainer) return { top: 0, left: 0 }
337
331
  var box = this.$refs.canvas3DContainer.getBoundingClientRect()
@@ -383,7 +377,7 @@ export default {
383
377
  },
384
378
  watch: {
385
379
  pvDataMemo: {
386
- handler(val) {
380
+ handler() {
387
381
  this.loadNewPanelTextures()
388
382
  }
389
383
  },
package/src/main.js CHANGED
@@ -9,8 +9,8 @@ Vue.use(Vuex)
9
9
  const Renderer = class {
10
10
  constructor() {}
11
11
  mount(identifier, geometryData, specificData, isInteractive = false) {
12
- if(specificData.isBuildingVisible===undefined){
13
- specificData.isBuildingVisible=true
12
+ if (specificData.isBuildingVisible === undefined) {
13
+ specificData.isBuildingVisible = true
14
14
  }
15
15
  const myStore = new Vuex.Store({
16
16
  modules: {
@@ -17,9 +17,7 @@ const init_state = {
17
17
 
18
18
  //for Panels
19
19
  cancelTokenGlobal: '',
20
- globalProjectProperties: [],
21
20
  buildingLocation: null,
22
- imageOverlay: null,
23
21
  layoutSettings: {
24
22
  layout_latitude: null,
25
23
  layout_longitude: null,
package/vue.config.js CHANGED
@@ -32,7 +32,7 @@ module.exports = {
32
32
  test: /\.(js)$/,
33
33
  // exclude: /\node_modules/,
34
34
  use: 'babel-loader'
35
- },
35
+ }
36
36
  ]
37
37
  },
38
38
  plugins: [