@eturnity/eturnity_3d 6.34.0 → 6.34.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.
Files changed (41) hide show
  1. package/.editorconfig +5 -0
  2. package/package.json +8 -4
  3. package/src/App.vue +16 -16
  4. package/src/assets/theme.js +4 -4
  5. package/src/components/ThreeCanvasViewer.vue +56 -43
  6. package/src/config.js +139 -65
  7. package/src/helper/MapView.js +214 -241
  8. package/src/helper/UpdateRoofModuleFieldRelations.js +17 -23
  9. package/src/helper/UpdateRoofObstacleRelations.js +48 -41
  10. package/src/helper/cameraMixin.js +97 -93
  11. package/src/helper/customProvider.js +28 -28
  12. package/src/helper/materialMixin.js +86 -70
  13. package/src/helper/materials.js +64 -49
  14. package/src/helper/render/background.js +2 -5
  15. package/src/helper/render/base.js +43 -40
  16. package/src/helper/render/clear.js +96 -84
  17. package/src/helper/render/edge.js +59 -65
  18. package/src/helper/render/geometryHandler.js +166 -128
  19. package/src/helper/render/imageOverlay.js +157 -106
  20. package/src/helper/render/index.js +21 -3
  21. package/src/helper/render/loader.js +34 -34
  22. package/src/helper/render/mapProjection.js +88 -74
  23. package/src/helper/render/margin.js +46 -50
  24. package/src/helper/render/moduleField.js +26 -24
  25. package/src/helper/render/node.js +43 -43
  26. package/src/helper/render/obstacle.js +50 -48
  27. package/src/helper/render/panel.js +85 -79
  28. package/src/helper/render/projectionMaterial.js +58 -50
  29. package/src/helper/render/roof.js +136 -133
  30. package/src/helper/render/texture.js +17 -17
  31. package/src/helper/render/tile.js +291 -0
  32. package/src/helper/renderMixin.js +30 -37
  33. package/src/helper/threeMixin.js +40 -101
  34. package/src/main.js +22 -18
  35. package/src/store/AddMargin.js +87 -83
  36. package/src/store/hydrateData.js +40 -30
  37. package/src/store/nodesEdgesCreation.js +177 -160
  38. package/src/store/three-d-module.js +41 -27
  39. package/src/utils/cancellablePromise.js +23 -0
  40. package/.eslintrc.json +0 -18
  41. package/src/helper/geo-three.module.js +0 -1903
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three'
2
- import {mapGetters} from 'vuex'
2
+ import { mapGetters } from 'vuex'
3
3
  import ProjectedMaterial from 'three-projected-material'
4
4
  import {
5
5
  substractVector,
@@ -8,119 +8,170 @@ import {
8
8
  getDistanceBetweenPoints,
9
9
  getAngleInDegFromCanvasVector
10
10
  } from '@eturnity/eturnity_maths'
11
- import {getBufferImageOverlayGeometry,updateBufferRoofGeometry} from './geometryHandler'
11
+ import {
12
+ getBufferImageOverlayGeometry,
13
+ updateBufferRoofGeometry
14
+ } from './geometryHandler'
12
15
 
13
16
  export default {
14
- data(){
15
- return {
16
- imageOverlayProjectionCamera: new THREE.PerspectiveCamera(1, 300 / 300, 100, 1000),
17
- imageOverlayTexture:null,
18
- imageOverlayMaterial:null,
19
- }
17
+ data() {
18
+ return {
19
+ imageOverlayProjectionCamera: new THREE.PerspectiveCamera(
20
+ 1,
21
+ 300 / 300,
22
+ 100,
23
+ 1000
24
+ ),
25
+ imageOverlayTexture: null,
26
+ imageOverlayMaterial: null
27
+ }
28
+ },
29
+ computed: {
30
+ ...mapGetters({
31
+ imageOverlay: 'getImageOverlay'
32
+ })
33
+ },
34
+ methods: {
35
+ renderImageOverlayOnBackground() {
36
+ if (!this.imageOverlay || !this.imageOverlayMaterial) {
37
+ this.clearMesh(this.meshes.backgroundMesh)
38
+ this.meshes.backgroundMesh = null
39
+ return
40
+ }
41
+ let corners = this.imageOverlay.corners.map((p) => {
42
+ return { ...p, z: 100 }
43
+ })
44
+ if (this.meshes.backgroundMesh && this.meshes.backgroundMesh.geometry) {
45
+ let geometry = this.meshes.backgroundMesh.geometry
46
+ geometry = updateBufferRoofGeometry(corners, [], geometry)
47
+ //updateBufferRoofGeometry(corners,[],geometry)
48
+ this.meshes.backgroundMesh.geometry = geometry
49
+ } else {
50
+ let planeGeometry = getBufferImageOverlayGeometry(corners)
51
+ let planeMaterial = this.imageOverlayMaterial
52
+
53
+ this.meshes.backgroundMesh = new THREE.Mesh(
54
+ planeGeometry,
55
+ planeMaterial
56
+ )
57
+ this.scene.add(this.meshes.backgroundMesh)
58
+ }
59
+ this.meshes.backgroundMesh.position.z = 0.15
60
+ if (this.imageOverlayMaterial) {
61
+ this.applyTextureOnMesh(
62
+ [this.imageOverlayMaterial],
63
+ this.meshes.backgroundMesh
64
+ )
65
+ }
66
+ this.meshes.backgroundMesh.visible = true
20
67
  },
21
- computed:{
22
- ...mapGetters({
23
- imageOverlay: 'getImageOverlay',
24
- }),
68
+ async changeImageOverlay() {
69
+ if (this.imageOverlayMaterial) {
70
+ this.imageOverlayMaterial.dispose()
71
+ this.imageOverlayMaterial = null
72
+ }
73
+ await this.updateProjectionMaterials()
25
74
  },
26
- methods:{
27
- renderImageOverlayOnBackground() {
28
- if(!this.imageOverlay || !this.imageOverlayMaterial){
29
- this.clearMesh(this.meshes.backgroundMesh)
30
- this.meshes.backgroundMesh=null
31
- return
32
- }
33
- let corners=this.imageOverlay.corners.map(p=>{return {...p,z:100}})
34
- if(this.meshes.backgroundMesh && this.meshes.backgroundMesh.geometry){
35
- let geometry=this.meshes.backgroundMesh.geometry
36
- geometry=updateBufferRoofGeometry(corners,[],geometry)
37
- //updateBufferRoofGeometry(corners,[],geometry)
38
- this.meshes.backgroundMesh.geometry=geometry
39
-
40
- }else{
41
- let planeGeometry = getBufferImageOverlayGeometry(corners)
42
- let planeMaterial = this.imageOverlayMaterial
43
-
44
- this.meshes.backgroundMesh = new THREE.Mesh(planeGeometry, planeMaterial)
45
- this.scene.add(this.meshes.backgroundMesh)
46
- }
47
- this.meshes.backgroundMesh.position.z=0.15
48
- if(this.imageOverlayMaterial){
49
- this.applyTextureOnMesh([this.imageOverlayMaterial],this.meshes.backgroundMesh)
50
- }
51
- this.meshes.backgroundMesh.visible=true
52
- },
53
- async changeImageOverlay(){
54
- if(this.imageOverlayMaterial){
75
+ async getImageOverlayMaterial() {
76
+ if (!this.imageOverlay || !this.imageOverlay.url) {
77
+ if (this.imageOverlayMaterial) {
55
78
  this.imageOverlayMaterial.dispose()
56
- this.imageOverlayMaterial=null
57
- }
58
- await this.updateProjectionMaterials()
59
- },
60
- async getImageOverlayMaterial(){
61
- if(!this.imageOverlay || !this.imageOverlay.url){
62
- if(this.imageOverlayMaterial){
63
- this.imageOverlayMaterial.dispose()
64
- }
65
- this.imageOverlayMaterial=null
66
- return null
67
79
  }
80
+ this.imageOverlayMaterial = null
81
+ return null
82
+ }
68
83
 
69
- if(!this.imageOverlayMaterial || this.imageOverlay.url!= this.imageOverlayMaterial.userData.url){
70
- this.imageOverlayMaterial = await this.newImageOverlayMaterial()
71
- }else{
84
+ if (
85
+ !this.imageOverlayMaterial ||
86
+ this.imageOverlay.url != this.imageOverlayMaterial.userData.url
87
+ ) {
88
+ this.imageOverlayMaterial = await this.newImageOverlayMaterial()
89
+ } else {
90
+ this.setImageOverlayCameraPosition()
91
+ }
92
+ return this.imageOverlayMaterial
93
+ },
94
+ removeImageOverlay() {
95
+ if (this.imageOverlayMaterial && this.imageOverlayMaterial.dispose)
96
+ this.imageOverlayMaterial.dispose()
97
+ this.imageOverlayMaterial = null
98
+ this.material.roof = this.material.roof.filter(
99
+ (material) => material.userData.type != 'imageOverlayMaterial'
100
+ )
101
+ },
102
+ async newImageOverlayMaterial() {
103
+ return new Promise((resolve) => {
104
+ this.loader.load(this.imageOverlay.url, (texture) => {
105
+ this.imageOverlayTexture = texture
72
106
  this.setImageOverlayCameraPosition()
73
- }
74
- return this.imageOverlayMaterial
75
- },
76
- removeImageOverlay(){
77
- if(this.imageOverlayMaterial && this.imageOverlayMaterial.dispose)
78
- this.imageOverlayMaterial.dispose()
79
- this.imageOverlayMaterial=null
80
- this.material.roof=this.material.roof.filter(material=>material.userData.type!='imageOverlayMaterial')
81
- },
82
- async newImageOverlayMaterial(){
83
- return new Promise((resolve)=>{this.loader.load(this.imageOverlay.url,(texture)=>{
84
- this.imageOverlayTexture=texture
85
- this.setImageOverlayCameraPosition()
86
- let imageOverlayProjectionMaterial = new ProjectedMaterial({
87
- camera: this.imageOverlayProjectionCamera,
88
- texture: this.imageOverlayTexture,
89
- transparent: true,
90
- side: THREE.DoubleSide,
91
- depthWrite: false
92
- })
93
- imageOverlayProjectionMaterial.userData={}
94
- imageOverlayProjectionMaterial.userData.type="imageOverlayMaterial"
95
- imageOverlayProjectionMaterial.userData.priority=2
96
- imageOverlayProjectionMaterial.userData.url=this.imageOverlay.url
97
- resolve(imageOverlayProjectionMaterial)
98
- })
99
- })
100
- },
101
- setImageOverlayCameraPosition(){
102
- if(!this.imageOverlay || !this.imageOverlay.url) return
103
- let height=getDistanceBetweenPoints(this.imageOverlay.corners[1],this.imageOverlay.corners[2])
104
- let width=getDistanceBetweenPoints(this.imageOverlay.corners[0],this.imageOverlay.corners[1])
105
- this.imageOverlayProjectionCamera.aspect =
106
- width / height
107
- let projectionAltitude = height /(2 * Math.tan((this.imageOverlayProjectionCamera.fov * Math.PI) / 360))
107
+ let imageOverlayProjectionMaterial = new ProjectedMaterial({
108
+ camera: this.imageOverlayProjectionCamera,
109
+ texture: this.imageOverlayTexture,
110
+ transparent: true,
111
+ side: THREE.DoubleSide,
112
+ depthWrite: false
113
+ })
114
+ imageOverlayProjectionMaterial.userData = {}
115
+ imageOverlayProjectionMaterial.userData.type = 'imageOverlayMaterial'
116
+ imageOverlayProjectionMaterial.userData.priority = 2
117
+ imageOverlayProjectionMaterial.userData.url = this.imageOverlay.url
118
+ resolve(imageOverlayProjectionMaterial)
119
+ })
120
+ })
121
+ },
122
+ setImageOverlayCameraPosition() {
123
+ if (!this.imageOverlay || !this.imageOverlay.url) return
124
+ let height = getDistanceBetweenPoints(
125
+ this.imageOverlay.corners[1],
126
+ this.imageOverlay.corners[2]
127
+ )
128
+ let width = getDistanceBetweenPoints(
129
+ this.imageOverlay.corners[0],
130
+ this.imageOverlay.corners[1]
131
+ )
132
+ this.imageOverlayProjectionCamera.aspect = width / height
133
+ let projectionAltitude =
134
+ height /
135
+ (2 * Math.tan((this.imageOverlayProjectionCamera.fov * Math.PI) / 360))
136
+
137
+ //set projection camera over background_map_center
138
+ let imageOverlayProjectionCameraPosition = {
139
+ x: 0,
140
+ y: 0,
141
+ z: projectionAltitude / 1000
142
+ }
108
143
 
144
+ let positionInMm = multiplyVector(
145
+ 0.5,
146
+ addVector(this.imageOverlay.corners[0], this.imageOverlay.corners[2])
147
+ )
148
+ imageOverlayProjectionCameraPosition.x = positionInMm.x / 1000
149
+ imageOverlayProjectionCameraPosition.y = positionInMm.y / 1000
109
150
 
110
- //set projection camera over background_map_center
111
- let imageOverlayProjectionCameraPosition={x:0,y:0,z:projectionAltitude / 1000}
112
-
113
- let positionInMm=multiplyVector(0.5,addVector(this.imageOverlay.corners[0],this.imageOverlay.corners[2]))
114
- imageOverlayProjectionCameraPosition.x=positionInMm.x/1000
115
- imageOverlayProjectionCameraPosition.y=positionInMm.y/1000
116
-
117
- this.imageOverlayProjectionCamera.position.set(imageOverlayProjectionCameraPosition.x, imageOverlayProjectionCameraPosition.y, projectionAltitude / 1000)
118
- this.imageOverlayProjectionCamera.lookAt(imageOverlayProjectionCameraPosition.x, imageOverlayProjectionCameraPosition.y,0)
119
- let zAngle=getAngleInDegFromCanvasVector(substractVector(this.imageOverlay.corners[3],this.imageOverlay.corners[0]))
120
- this.imageOverlayProjectionCamera.rotation.set(0, 0, zAngle*Math.PI/180)
121
- this.imageOverlayProjectionCamera.far = projectionAltitude * 1.5
122
- this.imageOverlayProjectionCamera.near = projectionAltitude * 0.8
123
- this.imageOverlayProjectionCamera.updateProjectionMatrix()
124
- },
151
+ this.imageOverlayProjectionCamera.position.set(
152
+ imageOverlayProjectionCameraPosition.x,
153
+ imageOverlayProjectionCameraPosition.y,
154
+ projectionAltitude / 1000
155
+ )
156
+ this.imageOverlayProjectionCamera.lookAt(
157
+ imageOverlayProjectionCameraPosition.x,
158
+ imageOverlayProjectionCameraPosition.y,
159
+ 0
160
+ )
161
+ let zAngle = getAngleInDegFromCanvasVector(
162
+ substractVector(
163
+ this.imageOverlay.corners[3],
164
+ this.imageOverlay.corners[0]
165
+ )
166
+ )
167
+ this.imageOverlayProjectionCamera.rotation.set(
168
+ 0,
169
+ 0,
170
+ (zAngle * Math.PI) / 180
171
+ )
172
+ this.imageOverlayProjectionCamera.far = projectionAltitude * 1.5
173
+ this.imageOverlayProjectionCamera.near = projectionAltitude * 0.8
174
+ this.imageOverlayProjectionCamera.updateProjectionMatrix()
125
175
  }
126
- }
176
+ }
177
+ }
@@ -13,8 +13,26 @@ import imageOverlay from './imageOverlay'
13
13
  import mapProjection from './mapProjection'
14
14
  import texture from './texture'
15
15
  import projectionMaterial from './projectionMaterial'
16
+ import tile from './tile'
16
17
 
17
18
  export default {
18
- //mixins:[node,background,clear,edge,loader,margin,moduleField,obstacle,panel,roof,base]
19
- mixins:[margin,node,background, base,roof,edge,obstacle,moduleField,panel,clear,loader,imageOverlay,texture,mapProjection,projectionMaterial]
20
- }
19
+ //mixins:[node,background,clear,edge,loader,margin,moduleField,obstacle,panel,roof,base]
20
+ mixins: [
21
+ margin,
22
+ node,
23
+ background,
24
+ base,
25
+ roof,
26
+ edge,
27
+ obstacle,
28
+ moduleField,
29
+ panel,
30
+ clear,
31
+ loader,
32
+ imageOverlay,
33
+ texture,
34
+ mapProjection,
35
+ projectionMaterial,
36
+ tile
37
+ ]
38
+ }
@@ -2,41 +2,41 @@ import * as THREE from 'three'
2
2
  import ProjectedMaterial from 'three-projected-material'
3
3
 
4
4
  export default {
5
- methods:{
6
- loadNewPanelTextures(){
7
- Object.values(this.pvDataMemo).forEach((component) => {
8
- const pvId = component.id
9
- if (!this.material.panel[pvId]) {
10
- if (!component.texture_img_url) {
11
- this.material.panel[pvId] = this.material.panel.default
12
- } else {
13
- let texture = this.loader.load(component.texture_img_url)
14
- this.material.panel[pvId] = new THREE.MeshBasicMaterial({
15
- map: texture,
16
- side: THREE.DoubleSide,
17
- transparent: true
18
- })
19
- }
5
+ methods: {
6
+ loadNewPanelTextures() {
7
+ Object.values(this.pvDataMemo).forEach((component) => {
8
+ const pvId = component.id
9
+ if (!this.material.panel[pvId]) {
10
+ if (!component.texture_img_url) {
11
+ this.material.panel[pvId] = this.material.panel.default
12
+ } else {
13
+ let texture = this.loader.load(component.texture_img_url)
14
+ this.material.panel[pvId] = new THREE.MeshBasicMaterial({
15
+ map: texture,
16
+ side: THREE.DoubleSide,
17
+ transparent: true
18
+ })
20
19
  }
21
- })
22
- },
23
- async loadPanelsTexture(){
24
- for(let k=0;k<this.moduleFields.length;k++){
25
- let mf=this.moduleFields[k]
26
- const pvId = mf.data.component_id_pv_module
27
- if (!this.material.panel[pvId]) {
28
- if (!mf.data.texture_img_url) {
29
- this.material.panel[pvId] = this.material.panel.default
30
- } 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.DoubleSide,
35
- transparent: true
36
- })
37
- }
20
+ }
21
+ })
22
+ },
23
+ async loadPanelsTexture() {
24
+ for (let k = 0; k < this.moduleFields.length; k++) {
25
+ let mf = this.moduleFields[k]
26
+ const pvId = mf.data.component_id_pv_module
27
+ if (!this.material.panel[pvId]) {
28
+ if (!mf.data.texture_img_url) {
29
+ this.material.panel[pvId] = this.material.panel.default
30
+ } 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.DoubleSide,
35
+ transparent: true
36
+ })
38
37
  }
39
38
  }
40
- },
39
+ }
41
40
  }
42
- }
41
+ }
42
+ }
@@ -2,85 +2,99 @@ import * as THREE from 'three'
2
2
  import ProjectedMaterial from 'three-projected-material'
3
3
 
4
4
  export default {
5
- data(){
6
- return {
7
- mapProjectionTexture:null,
8
- mapProjectionMaterial:null
5
+ data() {
6
+ return {
7
+ mapProjectionTexture: null,
8
+ mapProjectionMaterial: null
9
+ }
10
+ },
11
+ methods: {
12
+ async changeMapProjection() {
13
+ if (this.mapProjectionMaterial) {
14
+ this.mapProjectionMaterial.dispose()
15
+ this.mapProjectionMaterial = null
9
16
  }
17
+ await this.updateProjectionMaterials()
10
18
  },
11
- methods:{
12
- async changeMapProjection(){
13
- if(this.mapProjectionMaterial){
14
- this.mapProjectionMaterial.dispose()
15
- this.mapProjectionMaterial=null
16
- }
17
- await this.updateProjectionMaterials()
18
- },
19
- async getMapProjectionMaterial(){
20
- if(!this.layoutSettings.base64_image_url){
21
- return null
22
- }else{
23
- if(!this.mapProjectionMaterial){
24
- this.mapProjectionMaterial = await this.newMapProjectionMaterial()
25
- }else{
26
- this.setMapProjectionCameraPosition()
27
- }
28
- }
29
- return this.mapProjectionMaterial
30
- },
31
-
32
- async newMapProjectionMaterial() {
33
- return new Promise((resolve,reject) => {
34
- this.loader.load(this.layoutSettings.base64_image_url,(texture)=>{
35
- this.mapProjectionTexture=texture
36
- this.setMapProjectionCameraPosition()
37
- let mapProjectionMaterial = new ProjectedMaterial({
38
- camera: this.cameraprojection,
39
- texture: texture,
40
- transparent: true,
41
- side: THREE.DoubleSide,
42
- })
43
- mapProjectionMaterial.userData={}
44
- mapProjectionMaterial.userData.type="mapProjectionMaterial"
45
- mapProjectionMaterial.userData.priority=1
46
- mapProjectionMaterial.userData.url=this.layoutSettings.base64_image_url
47
- resolve(mapProjectionMaterial)
48
- })
49
- })
50
- },
51
- setMapProjectionCameraPosition(){
52
- let backgroundImageCenter={
53
- lat:this.layoutSettings.layout_latitude,
54
- lng:this.layoutSettings.layout_longitude
19
+ async getMapProjectionMaterial() {
20
+ if (!this.layoutSettings.base64_image_url) {
21
+ return null
22
+ } else {
23
+ if (!this.mapProjectionMaterial) {
24
+ this.mapProjectionMaterial = await this.newMapProjectionMaterial()
25
+ } else {
26
+ this.setMapProjectionCameraPosition()
55
27
  }
56
- if(this.layoutSettings.background_map_settings){
57
- backgroundImageCenter={
58
- lat:this.layoutSettings.background_map_settings.lat,
59
- lng:this.layoutSettings.background_map_settings.lng
60
- }
28
+ }
29
+ return this.mapProjectionMaterial
30
+ },
31
+
32
+ async newMapProjectionMaterial() {
33
+ return new Promise((resolve, reject) => {
34
+ this.loader.load(this.layoutSettings.base64_image_url, (texture) => {
35
+ this.mapProjectionTexture = texture
36
+ this.setMapProjectionCameraPosition()
37
+ let mapProjectionMaterial = new ProjectedMaterial({
38
+ camera: this.cameraprojection,
39
+ texture: texture,
40
+ transparent: true,
41
+ side: THREE.DoubleSide
42
+ })
43
+ mapProjectionMaterial.userData = {}
44
+ mapProjectionMaterial.userData.type = 'mapProjectionMaterial'
45
+ mapProjectionMaterial.userData.priority = 1
46
+ mapProjectionMaterial.userData.url =
47
+ this.layoutSettings.base64_image_url
48
+ resolve(mapProjectionMaterial)
49
+ })
50
+ })
51
+ },
52
+ setMapProjectionCameraPosition() {
53
+ let backgroundImageCenter = {
54
+ lat: this.layoutSettings.layout_latitude,
55
+ lng: this.layoutSettings.layout_longitude
56
+ }
57
+ if (this.layoutSettings.background_map_settings) {
58
+ backgroundImageCenter = {
59
+ lat: this.layoutSettings.background_map_settings.lat,
60
+ lng: this.layoutSettings.background_map_settings.lng
61
61
  }
62
- this.backgroundImagesizeInMm=this.layoutSettings.background_map_settings.sizeInMm
63
- if (this.backgroundImagesizeInMm) {
64
- this.cameraprojection.aspect =
65
- this.backgroundImagesizeInMm.width / this.backgroundImagesizeInMm.height
66
- let projectionAltitude =
62
+ }
63
+ this.backgroundImagesizeInMm =
64
+ this.layoutSettings.background_map_settings.sizeInMm
65
+ if (this.backgroundImagesizeInMm) {
66
+ this.cameraprojection.aspect =
67
+ this.backgroundImagesizeInMm.width /
68
+ this.backgroundImagesizeInMm.height
69
+ let projectionAltitude =
67
70
  this.backgroundImagesizeInMm.height /
68
- (2 * Math.tan((this.cameraprojection.fov * Math.PI) / 360))
71
+ (2 * Math.tan((this.cameraprojection.fov * Math.PI) / 360))
69
72
 
70
- //set projection camera over background_map_center
71
- let cameraProjectionPosition={x:0,y:0,z:projectionAltitude / 1000}
72
- if(this.layoutSettings.background_map_settings && this.layoutSettings.background_map_settings.positionInMm){
73
- let positionInMm=this.layoutSettings.background_map_settings.positionInMm
74
- cameraProjectionPosition.x=positionInMm.x/1000
75
- cameraProjectionPosition.y=positionInMm.y/1000
76
- }
77
-
78
- this.cameraprojection.position.set(cameraProjectionPosition.x, cameraProjectionPosition.y, projectionAltitude / 1000)
79
- this.cameraprojection.far = projectionAltitude * 1.5
80
- this.cameraprojection.near = projectionAltitude * 0.5
81
- this.cameraprojection.updateProjectionMatrix()
73
+ //set projection camera over background_map_center
74
+ let cameraProjectionPosition = {
75
+ x: 0,
76
+ y: 0,
77
+ z: projectionAltitude / 1000
82
78
  }
83
- },
84
-
79
+ if (
80
+ this.layoutSettings.background_map_settings &&
81
+ this.layoutSettings.background_map_settings.positionInMm
82
+ ) {
83
+ let positionInMm =
84
+ this.layoutSettings.background_map_settings.positionInMm
85
+ cameraProjectionPosition.x = positionInMm.x / 1000
86
+ cameraProjectionPosition.y = positionInMm.y / 1000
87
+ }
88
+
89
+ this.cameraprojection.position.set(
90
+ cameraProjectionPosition.x,
91
+ cameraProjectionPosition.y,
92
+ projectionAltitude / 1000
93
+ )
94
+ this.cameraprojection.far = projectionAltitude * 1.5
95
+ this.cameraprojection.near = projectionAltitude * 0.5
96
+ this.cameraprojection.updateProjectionMatrix()
97
+ }
85
98
  }
86
- }
99
+ }
100
+ }