Commit 7ae4a05f authored by rockyl's avatar rockyl

修复节点偏移的问题

parent 81f17997
...@@ -183,8 +183,8 @@ ...@@ -183,8 +183,8 @@
}, },
onResize() { onResize() {
const {x, y} = this.$el.getBoundingClientRect(); const {x, y} = this.$el.getBoundingClientRect();
this.drawState.boardOffset.x = x; this.drawState.boardOffset.x = x + this.boardOffset.x;
this.drawState.boardOffset.y = y; this.drawState.boardOffset.y = y + this.boardOffset.y;
}, },
measure() { measure() {
this.onResize(); this.onResize();
...@@ -243,8 +243,8 @@ ...@@ -243,8 +243,8 @@
}, },
onMouseMove(e) { onMouseMove(e) {
const scale = this.scale; const scale = this.scale;
let x = e.x - this.drawState.boardOffset.x - this.boardOffset.x; let x = e.x - this.drawState.boardOffset.x;
let y = e.y - this.drawState.boardOffset.y - this.boardOffset.y; let y = e.y - this.drawState.boardOffset.y;
this.lineDrawing.path = this.drawingLineStart + `${x / scale},${y / scale} ${x / scale},${y / scale}`; this.lineDrawing.path = this.drawingLineStart + `${x / scale},${y / scale} ${x / scale},${y / scale}`;
}, },
onMouseUp(e) { onMouseUp(e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment