|
@@ -44,7 +44,6 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.modelId = this.$route.query.modelId;
|
|
|
|
this.FloorID = this.$route.query.FloorID;
|
|
this.FloorID = this.$route.query.FloorID;
|
|
this.OutlineFlag = this.$route.query.OutlineFlag;
|
|
this.OutlineFlag = this.$route.query.OutlineFlag;
|
|
},
|
|
},
|
|
@@ -55,9 +54,8 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
initGraphy(ModelId) {
|
|
initGraphy(ModelId) {
|
|
let that = this;
|
|
let that = this;
|
|
|
|
+ that.modelId = ModelId;
|
|
that.clearGraphy()
|
|
that.clearGraphy()
|
|
- let id = `floorCanvas${that.id}`;
|
|
|
|
- that.view = new SGraphyView(id)
|
|
|
|
that.drawMainScene = new DivideFloorScene();
|
|
that.drawMainScene = new DivideFloorScene();
|
|
that.canvasLoading = true;
|
|
that.canvasLoading = true;
|
|
that.drawMainScene.getFloorData('/modelapi/base-graph/query', { ModelId: ModelId }).then(res => {
|
|
that.drawMainScene.getFloorData('/modelapi/base-graph/query', { ModelId: ModelId }).then(res => {
|
|
@@ -74,8 +72,10 @@ export default {
|
|
that.canvasLoading = false;
|
|
that.canvasLoading = false;
|
|
that.view.maxScale = that.view.scale * 10;
|
|
that.view.maxScale = that.view.scale * 10;
|
|
that.view.minScale = that.view.scale;
|
|
that.view.minScale = that.view.scale;
|
|
- that.$refs.canvasFun.everyScale = that.view.scale;
|
|
|
|
that.drawMainScene.isSpaceSelectable = false;
|
|
that.drawMainScene.isSpaceSelectable = false;
|
|
|
|
+ if (this.$refs.canvasFun) {
|
|
|
|
+ that.$refs.canvasFun.everyScale = that.view.scale;
|
|
|
|
+ }
|
|
if (that.OutlineFlag) {
|
|
if (that.OutlineFlag) {
|
|
this.getFloorData()
|
|
this.getFloorData()
|
|
}
|
|
}
|
|
@@ -96,10 +96,11 @@ export default {
|
|
// 清空平面图
|
|
// 清空平面图
|
|
clearGraphy() {
|
|
clearGraphy() {
|
|
if (this.view) {
|
|
if (this.view) {
|
|
- this.drawMainScene.root.children = null;
|
|
|
|
- this.drawMainScene = null;
|
|
|
|
- this.view = null;
|
|
|
|
|
|
+ this.view.scene = null;
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
+ let id = `floorCanvas${this.id}`;
|
|
|
|
+ this.view = new SGraphyView(id)
|
|
},
|
|
},
|
|
// canvas 获取焦点
|
|
// canvas 获取焦点
|
|
focus() {
|
|
focus() {
|
|
@@ -144,6 +145,9 @@ export default {
|
|
redo() { },
|
|
redo() { },
|
|
// 缩放
|
|
// 缩放
|
|
scale(val) {
|
|
scale(val) {
|
|
|
|
+ if (!this.view) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
let scale = this.view.scale;
|
|
let scale = this.view.scale;
|
|
this.view.scaleByPoint(val / scale, this.cadWidth / 2, this.cadHeight / 2)
|
|
this.view.scaleByPoint(val / scale, this.cadWidth / 2, this.cadHeight / 2)
|
|
},
|
|
},
|