hoffstadt / hoffstadt/DearPyGui
mouse pos in plot and axis limit range
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 0.816
Operating System: Windows 10
## My Issue/Question
I do not think you fix in https://github.com/hoffstadt/DearPyGui/issues/912#issuecomment-875196074
```python
mouse_x, mouse_y = dpg.get_plot_mouse_pos()
ymin, ymax = dpg.get_axis_limits(self.plot_axis_y)
xmin, xmax = dpg.get_axis_limits(self.plot_axis_x)
```
`mouse_x` will always larger than `xmin`
`mouse_y` will always larger than `ymin`
## To Reproduce
use add_mouse_wheel_handler to print
dpg.get_plot_mouse_pos()
dpg.get_axis_limits(self.plot_axis_y)
dpg.get_axis_limits(self.plot_axis_x)
## Expected behavior
`mouse_x` should less than `xmin` when mouse in y axis left side
`mouse_y` should less than `ymin` when mouse below x axis
## Screenshots/Video

## Standalone, minimal, complete and verifiable example
```python
from math import cos, pi, sin
import dearpygui.dearpygui as dpg
with dpg.window(label="Label", width=800, height=600):
with dpg.plot(label="plot_name", width=-1, height=-1):
dpg.add_plot_legend()
plot_axis_x = dpg.add_plot_axis(dpg.mvXAxis, label="")
plot_axis_y = dpg.add_plot_axis(dpg.mvYAxis, label="")
plot_id = dpg.last_item()
series_id_1 = dpg.add_line_series(list(range(5)), list(cos(i * pi / 100) for i in range(5)), label="Test 1", parent=plot_id, contribute_to_bounds=False)
def on_mouse_wheel_callback(sender, app_data):
mouse_x, mouse_y = dpg.get_plot_mouse_pos()
ymin, ymax = dpg.get_axis_limits(plot_axis_y)
print(f"ymin {ymin} mouse_y {mouse_y} {mouse_y < ymin}")
with dpg.handler_registry():
dpg.add_mouse_wheel_handler(callback=on_mouse_wheel_callback)
dpg.start_dearpygui()
```
Contributor guide
Assessment
This issue has not been assessed yet.