| | |
| | | </div> |
| | | </div> |
| | | `, |
| | | props: ['lev', 'zoom', 'crnParam', 'rgvParam', 'devpParam', 'highlightOnParamChange'], |
| | | props: ['lev', 'crnParam', 'rgvParam', 'devpParam', 'highlightOnParamChange'], |
| | | data() { |
| | | return { |
| | | map: [], |
| | |
| | | watch: { |
| | | lev(newLev) { |
| | | if (newLev != null) { this.changeFloor(newLev); } |
| | | }, |
| | | zoom(newZoom) { |
| | | this.applyZoom(newZoom); |
| | | }, |
| | | crnParam: { |
| | | deep: true, |
| | |
| | | getTrackSiteNo(obj) { |
| | | if (this.isJson(obj)) { let data = JSON.parse(obj); if (data.trackSiteNo == null || data.trackSiteNo == undefined) { return -1; } return data.trackSiteNo; } else { return -1; } |
| | | }, |
| | | applyZoom(z) { |
| | | let scale = 1; |
| | | if (typeof z === 'number') { scale = Math.max(0.1, Math.min(5, z / 100)); } |
| | | const sx = this.pixiApp.view.width / 2; |
| | | const sy = this.pixiApp.view.height / 2; |
| | | const oldZoom = this.pixiApp.stage.scale.x; |
| | | const worldX = (sx - this.pixiApp.stage.position.x) / oldZoom; |
| | | const worldY = (sy - this.pixiApp.stage.position.y) / oldZoom; |
| | | const newPosX = sx - worldX * scale; |
| | | const newPosY = sy - worldY * scale; |
| | | this.pixiApp.stage.setTransform(newPosX, newPosY, scale, scale, 0, 0, 0, 0, 0); |
| | | } |
| | | } |
| | | }); |