DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Double click on a plot does not consider drag points

Open nebehr opened this issue 2 years ago • 1 comments

Version of Dear PyGui

Version: 1.8.0 Operating System: Windows 10

My Issue/Question

Double-click fit function in plots does not consider items such as drag points, drag lines and other elements drawn on it (such as lines and shapes), only actual data series.

To Reproduce

  1. Run the following snippet (this is actually an example from documentation with removed axis limits).
  2. Drag the plot so that some of the points are not visible.
  3. Left double click - nothing happens.

If a data series is added, plot will be redrawn on double click, but only to include data from the series.

Expected behavior

On double click plot should be redrawn to show all its children, not just data series.

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

dpg.create_context()

with dpg.window(label="Tutorial", width=400, height=400):
    with dpg.plot(label="Drag Lines/Points", height=-1, width=-1):
        dpg.add_plot_legend()
        dpg.add_plot_axis(dpg.mvXAxis, label="x")
        dpg.add_plot_axis(dpg.mvYAxis, label="y")
   
        # drag lines/points belong to the plot NOT axis
        dpg.add_drag_line(label="dline1", color=[255, 0, 0, 255], default_value=2.0)
        dpg.add_drag_line(label="dline2", color=[255, 255, 0, 255], vertical=False, default_value=-2)
        dpg.add_drag_point(label="dpoint1", color=[255, 0, 255, 255], default_value=(1.0, 1.0))
        dpg.add_drag_point(label="dpoint2", color=[255, 0, 255, 255], default_value=(-1.0, 1.0))

dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

nebehr avatar Feb 21 '23 15:02 nebehr

PR #2275 is going to (partially) fix this: all drag tools (drag point, drag line, drag rect) will be used for auto-fit, unless no_fit=True is specified for them. Unfortunately this does not apply to drawing API objects.

v-ein avatar Jun 24 '24 10:06 v-ein