Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I remove indicators from a dom tree? #164

Open
hankaibo opened this issue Dec 17, 2024 · 1 comment
Open

How do I remove indicators from a dom tree? #164

hankaibo opened this issue Dec 17, 2024 · 1 comment

Comments

@hankaibo
Copy link

Hi, I referenced your tree example and wrote a version for vue: https://github.com/mypandora/query-builder/tree/main
But my tree is nested, when I move it first goes to parent P, then add indicator; continue moving and go to child C and show another indicator.
Because the child is inside the parent, it doesn't trigger onDragLeave, so I can't remove the tag from the parent.

How should this be resolved?

thanks.

@hankaibo
Copy link
Author

hankaibo commented Dec 18, 2024

I found a way to do this, not sure if it's a reasonable solution.
I added the judgement to onDrag: https://github.com/mypandora/query-builder/blob/main/lib/TreeNode.vue#L168:L175

if (location.current.dropTargets.length > 1) {
// console.log("location", this.node?.name, this, location);
  if (this.node?.children) {
    this.instruction = null;
    return;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant