Skip to content

Commit

Permalink
fix bug that customized node can not be dragged (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
hizzgdev authored Jan 22, 2024
1 parent 98d025d commit 2735c6e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/plugins/jsmind.draggable-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ class DraggableNode {
this.view_draggable = this.jm.get_view_draggable();

var jview = this.jm.view;
var el = e.target;
if (el.tagName.toLowerCase() != 'jmnode') {
var el = this.find_node_element(e.target);
if (!el) {
console.log('throw away');
return;
}
if (this.view_draggable) {
Expand Down Expand Up @@ -285,6 +286,19 @@ class DraggableNode {
this.moved = false;
this.capture = false;
}
find_node_element(el) {
if (
el === this.jm.view.e_nodes ||
el === this.jm.view.e_panel ||
el === this.jm.view.container
) {
return null;
}
if (el.tagName.toLowerCase() === 'jmnode') {
return el;
}
return this.find_node_element(el.parentNode);
}
lookup_target_node() {
let sx = this.shadow.offsetLeft;
let sy = this.shadow.offsetTop;
Expand Down

0 comments on commit 2735c6e

Please sign in to comment.