From 3b9cced7eaf9526d6652321de5b75a22fff7c9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Mon, 3 Mar 2025 17:23:03 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=9B=BE=E7=89=87=E8=B0=83=E6=95=B4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=BD=93=E7=94=BB=E5=B8=83=E7=BC=A9=E6=94=BE=E6=97=B6=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9BFeat=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=8A=9B?= =?UTF-8?q?=E5=87=BA=E4=B8=A4=E4=B8=AA=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/NodeImgAdjust.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/simple-mind-map/src/plugins/NodeImgAdjust.js b/simple-mind-map/src/plugins/NodeImgAdjust.js index 7f859c1d..9045ade1 100644 --- a/simple-mind-map/src/plugins/NodeImgAdjust.js +++ b/simple-mind-map/src/plugins/NodeImgAdjust.js @@ -31,12 +31,14 @@ class NodeImgAdjust { this.onMousemove = this.onMousemove.bind(this) this.onMouseup = this.onMouseup.bind(this) this.onRenderEnd = this.onRenderEnd.bind(this) + this.onScale = this.onScale.bind(this) this.mindMap.on('node_img_mouseleave', this.onNodeImgMouseleave) this.mindMap.on('node_img_mousemove', this.onNodeImgMousemove) this.mindMap.on('mousemove', this.onMousemove) this.mindMap.on('mouseup', this.onMouseup) this.mindMap.on('node_mouseup', this.onMouseup) this.mindMap.on('node_tree_render_end', this.onRenderEnd) + this.mindMap.on('scale', this.onScale) } // 解绑事件 @@ -47,6 +49,15 @@ class NodeImgAdjust { this.mindMap.off('mouseup', this.onMouseup) this.mindMap.off('node_mouseup', this.onMouseup) this.mindMap.off('node_tree_render_end', this.onRenderEnd) + this.mindMap.off('scale', this.onScale) + } + + // 如果当前操作按钮正在显示时缩放了画布,那么需要更新位置 + onScale() { + if (this.node && this.img && this.isShowHandleEl) { + this.rect = this.img.rbox() + this.setHandleElRect() + } } // 节点图片鼠标移动事件 @@ -210,6 +221,7 @@ class NodeImgAdjust { } if (!stop) { this.mindMap.execCommand('SET_NODE_IMAGE', this.node, { url: null }) + this.mindMap.emit('delete_node_img_from_delete_btn', this.node) } }) // 添加元素到页面 @@ -219,6 +231,7 @@ class NodeImgAdjust { // 鼠标按钮按下事件 onMousedown(e) { + this.mindMap.emit('node_img_adjust_btn_mousedown', this.node) this.isMousedown = true this.mousedownDrawTransform = this.mindMap.draw.transform() // 隐藏节点实际图片