Open tiantian1645 opened 3 years ago
Will check again.
This is not actually a bug. dpg.get_plot_mouse_pos()
returns the last recorded position of the mouse when it was on the plot. If you move the mouse off too quickly, the position will not necessary update to the boundary. Depends on the frame rate.
You can check this by slowly moving the mouse out of the plot region. You will see the value gets closer to the boundary.
The best course of action is to check if the plot is hovered BEFORE calling dpg.get_plot_mouse_pos()
.
Let me know if this makes sense.
I just want to disguish these
Scroll Mouse Wheel: zooms
Scroll Mouse Wheel on Axis: zooms only that axis
But now dpg.get_plot_mouse_pos
smaller than dpg.get_axis_limits
, How can I check if mouse is below X axis or left Y axis?
This is not actually a bug.
dpg.get_plot_mouse_pos()
returns the last recorded position of the mouse when it was on the plot. If you move the mouse off too quickly, the position will not necessary update to the boundary. Depends on the frame rate.You can check this by slowly moving the mouse out of the plot region. You will see the value gets closer to the boundary.
The best course of action is to check if the plot is hovered BEFORE calling
dpg.get_plot_mouse_pos()
.
is_item_hovered return true in the whole plot , the same range with get_axis_limits, so check hovered is invalid. It only work with different plots
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
mouse_x
will always larger thanxmin
mouse_y
will always larger thanymin
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 thanxmin
when mouse in y axis left sidemouse_y
should less thanymin
when mouse below x axisScreenshots/Video
Standalone, minimal, complete and verifiable example