From 284b40a525f96eae0fc2354481dbe9c053fdb9de Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Sat, 9 Mar 2024 18:13:36 +0800 Subject: [PATCH] mouseup --- altium_sch_renderer.js | 49 ++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/altium_sch_renderer.js b/altium_sch_renderer.js index d74e3ff..2d6a571 100644 --- a/altium_sch_renderer.js +++ b/altium_sch_renderer.js @@ -72,20 +72,7 @@ class AltiumSchematicRenderer } oldMove.call(this, sender, me); } - let oldClick = mxGraphHandler.prototype.mouseDown - mxGraphHandler.prototype.mouseDown = function(sender, me){ - console.log("mouse down",sender,me) - // https://github.com/jgraph/mxgraph/blob/master/javascript/src/js/handler/mxGraphHandler.js#L901 - if(me.state != undefined){ - if(me.state.cell.children != undefined){ - oldClick.call(this, sender, me); - }else{ - // oldClick.call(this, sender, me); - } - } - - } // https://github.com/jgraph/mxgraph/blob/master/javascript/src/js/handler/mxGraphHandler.js#L1036 mxGraphHandler.prototype.updatePreview = function(remote) { @@ -104,7 +91,41 @@ class AltiumSchematicRenderer this.graph = new mxGraph(document.getElementById('graphContainer')); - + let oldClick = mxGraphHandler.prototype.mouseDown + mxGraphHandler.prototype.mouseDown = function(sender, me){ + console.log("mouse down",sender,me) + // https://github.com/jgraph/mxgraph/blob/master/javascript/src/js/handler/mxGraphHandler.js#L901 + if(me.state != undefined){ + if(me.state.cell.children != undefined){ + oldClick.call(this, sender, me); + }else{ + console.log(me.state.cell) + if(me.state.cell.parent != undefined){ + this.graph.addSelectionCell(me.state.cell.parent) + oldClick.call(this, sender, me); + } + // oldClick.call(this, sender, me); + } + } + + } + + let oldMouseUp = mxGraphHandler.prototype.mouseUp + mxGraphHandler.prototype.mouseUp = function(sender, me){ + console.log("mouse down",sender,me) + // https://github.com/jgraph/mxgraph/blob/master/javascript/src/js/handler/mxGraphHandler.js#L901 + if(me.state != undefined){ + if(me.state.cell.children != undefined){ + oldMouseUp.call(this, sender, me); + }else{ + if(me.state.cell.parent != undefined){ + this.graph.addSelectionCell(me.state.cell.parent) + oldMouseUp.call(this, sender, me); + } + // oldClick.call(this, sender, me); + } + } + } this.graph.setPanning(true); this.graph.setConnectable(true);