hoffstadt / hoffstadt/DearPyGui
Draw list placed below title bar in window but rectangle pmin [0, 0] is placed correctly
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.2.3
Operating System: Windows 10
## My Issue/Question
The draw list is placed underneath the windows titlebar. But the rectangle with pmin [0, 0] is correctly draw in top left corner just below the title bar. So there is a mismatch between draw list and rectangle coordinates.
Problem disappears when there is no title bar.
The coordinates in the bottom left corner is of the drawlist when mouse is on title bar.
## Screenshots/Video

## Standalone, minimal, complete and verifiable example
```python
import dearpygui.dearpygui as dpg
SUITABLE_STATUSBAR_HEIGHT = 36 # centers the default font vertically, 2022-01-14
STATUSBAR_OFFSET_FROM_BOTTOM = 72 # offset from viewport bottom, 2022-01-14
def viewport_resize_callback(sender, app_data, user_data):
dpg.set_item_pos('statusbar', [0, dpg.get_viewport_height()-72])
dpg.set_item_width('statusbar', dpg.get_viewport_width())
def mouse_move_callback(sender, app_data, user_data):
# for showing mouse pos only when cursor in drawing area
mouse_x, mouse_y = app_data
pos_x, pos_y = dpg.get_item_pos(item='draw_window')
x = mouse_x - pos_x
y = mouse_y - pos_y
# if outside draw list then don't show coordinates
if x < 0 or y < 0 or x > dpg.get_item_width(item='drawlist') or y > dpg.get_item_height(item='drawlist'):
x = ''
y = ''
dpg.set_value(item='statbartext', value=f'x: {x} , y: {y}')
if __name__ == '__main__':
dpg.create_context()
dpg.create_viewport(title='Bombus', width=500, height=500)
dpg.set_viewport_resize_callback(viewport_resize_callback)
with dpg.window(tag='draw_window', width=400.0, height=400.0, pos=[20.0, 20.0], no_title_bar=True):
with dpg.drawlist(width=400.0, height=400.0, tag='drawlist', parent='draw_window'):
dpg.draw_rectangle(pmin=[0.0, 0.0], pmax=[400.0, 400.0])
with dpg.window(width=100, height=SUITABLE_STATUSBAR_HEIGHT,
tag='statusbar',
min_size=[dpg.get_viewport_width(), SUITABLE_STATUSBAR_HEIGHT],
max_size=[2560, SUITABLE_STATUSBAR_HEIGHT],
no_title_bar=True,
no_move=True):
dpg.add_text(default_value='', tag='statbartext')
with dpg.handler_registry():
dpg.add_mouse_move_handler(callback=mouse_move_callback)
# dpg.bind_item_handler_registry(item='drawarea', handler_registry='mouse_move')
dpg.show_style_editor()
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```
Contributor guide
Assessment
This issue has not been assessed yet.