zcy 2024-03-09 18:13:36 +08:00
parent 1b08d6592e
commit 284b40a525
1 changed files with 35 additions and 14 deletions

View File

@ -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);