hoffstadt / hoffstadt/DearPyGui
get_mouse_pos(local=True) returns wrong values when no_title_bar = True
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.10
Operating System: Windows 10
## My Issue/Question
get_mouse_pos() value turns negative when going where into the title bar area, which makes sense when there's a title bar, but when where's none either explicitly or by assigning a primary window the same calculations are given
A clear and concise description of what the issue/question is. Please provide as much context as possible.
## To Reproduce
1. Create a window with no_title_bar = True
2. Place the mouse where the title would be
3. Issue a call to get_mouse_pos()
4. Notice the negative value
## Expected behavior
Get coordinates relative to 0,0 in the window
## Standalone, minimal, complete and verifiable example
```python
import dearpygui.dearpygui as dpg
def log( text ):
config = dpg.get_item_configuration( "Listbox" )
dpg.configure_item( "Listbox", items = config[ "items" ] + [ text ], num_items = config[ "num_items" ] + 1 )
def moveCallback(sender,app_data):
log(dpg.get_mouse_pos(local=True))
log(app_data)
dpg.create_context()
dpg.create_viewport()
with dpg.window( tag = "Primary Window", pos=[0,0], width=600,height=600, no_title_bar=True ):
dpg.add_listbox(
[],
tag = "Listbox",
pos = [ 100,100],
width = 400,
tracked=True,
track_offset=1.0,
num_items = 0
)
with dpg.handler_registry():
dpg.add_mouse_move_handler(callback=moveCallback)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
``````
Contributor guide
Assessment
This issue has not been assessed yet.