#
Junjie
4 天以前 7451d4b759a30830514f8f398268d5694dcb1dde
src/main/webapp/components/MapCanvas.js
@@ -7,7 +7,7 @@
      </div>
    </div>
  `,
  props: ['lev', 'zoom', 'crnParam', 'rgvParam', 'devpParam', 'highlightOnParamChange'],
  props: ['lev', 'crnParam', 'rgvParam', 'devpParam', 'highlightOnParamChange'],
  data() {
    return {
      map: [],
@@ -50,9 +50,6 @@
  watch: {
    lev(newLev) {
      if (newLev != null) { this.changeFloor(newLev); }
    },
    zoom(newZoom) {
      this.applyZoom(newZoom);
    },
    crnParam: {
      deep: true,
@@ -861,17 +858,5 @@
    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);
    }
  }
});