hoffstadt / hoffstadt/DearPyGui
Be able to get mouse position within Node Editor
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I am trying to make a Drag and Drop node editor, where I have a sidebar from which I can select nodes to add to a Node Editor area:

I have implemented already the drag and drop functionality. However, dragged nodes appear in a wrong position (and not where the drop callback happens).
This is due to how the drop callback works: I just get the mouse position using `dpg.get_mouse_pos(local=False)`, and create a new Node in the Node Editor using that position.
The issue here is that positioning within the Node Editor work differently (it has its own coordinate system, which allows for panning through the editor by clicking the mouse wheel).
You can see the issue here:

**Describe the solution you'd like**
A simple way to get the mouse position within the Node Editor would solve the issue (using the same positioning system that `dpg.get_item_pos(some_node_item)`).
**Describe alternatives you've considered**
The only alternative I can think of is to always create new nodes in position `[0,0]`, but then drag and drop would not make sense.
**Additional context**
Nothing noteworthy
Thank you! I really like the library.
Contributor guide
Assessment
This issue has not been assessed yet.