Skip to content

Commit

Permalink
Fix Right Click a connection #411
Browse files Browse the repository at this point in the history
  • Loading branch information
jerosoler committed May 4, 2022
1 parent e040ac0 commit f4d10b2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/drawflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,13 @@ export default class Drawflow {
this.connection_selected = this.ele_selected;
this.connection_selected.classList.add("selected");
const listclassConnection = this.connection_selected.parentElement.classList;
this.dispatch('connectionSelected', { output_id: listclassConnection[2].slice(14), input_id: listclassConnection[1].slice(13), output_class: listclassConnection[3], input_class: listclassConnection[4] });
if(this.reroute_fix_curvature) {
this.connection_selected.parentElement.querySelectorAll(".main-path").forEach((item, i) => {
item.classList.add("selected");
});
if(listclassConnection.length > 1){
this.dispatch('connectionSelected', { output_id: listclassConnection[2].slice(14), input_id: listclassConnection[1].slice(13), output_class: listclassConnection[3], input_class: listclassConnection[4] });
if(this.reroute_fix_curvature) {
this.connection_selected.parentElement.querySelectorAll(".main-path").forEach((item, i) => {
item.classList.add("selected");
});
}
}
break;
case 'point':
Expand Down Expand Up @@ -531,7 +533,7 @@ export default class Drawflow {
this.node_selected.appendChild(deletebox);

}
if(this.connection_selected) {
if(this.connection_selected && (this.connection_selected.parentElement.classList.length > 1)) {
deletebox.style.top = e.clientY * ( this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) - (this.precanvas.getBoundingClientRect().y * ( this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) ) + "px";
deletebox.style.left = e.clientX * ( this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) - (this.precanvas.getBoundingClientRect().x * ( this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) ) + "px";

Expand Down

0 comments on commit f4d10b2

Please sign in to comment.