|
@@ -97,8 +97,8 @@ export default {
|
|
eventBus.$on("suitableRatios", function() {
|
|
eventBus.$on("suitableRatios", function() {
|
|
that.view.fitSceneToView();
|
|
that.view.fitSceneToView();
|
|
});
|
|
});
|
|
- eventBus.$on("changeRatios", function(val) {
|
|
|
|
- that.changeRatios(val)
|
|
|
|
|
|
+ eventBus.$on("changeRatios", function(val) {
|
|
|
|
+ that.changeRatios(val);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -157,8 +157,17 @@ export default {
|
|
leftClickMove(a, b) {
|
|
leftClickMove(a, b) {
|
|
// console.log('move',a,b)
|
|
// console.log('move',a,b)
|
|
},
|
|
},
|
|
- changeRatios(val){
|
|
|
|
- console.log('val',val)
|
|
|
|
|
|
+ changeRatios(val) {
|
|
|
|
+ //获取中心点
|
|
|
|
+ let rect = this.view.scene.worldRect();
|
|
|
|
+ // //计算缩放比例
|
|
|
|
+ this.view.scale = this.view.scale * val *5;
|
|
|
|
+ // // 移动画布
|
|
|
|
+ this.view.origin.x =
|
|
|
|
+ (-(rect.right + rect.left) / 2) * this.view.scale + this.view.width / 2;
|
|
|
|
+ this.view.origin.y =
|
|
|
|
+ (-(rect.bottom + rect.top) / 2) * this.view.scale +
|
|
|
|
+ this.view.height / 2;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|