@@ -41,16 +41,6 @@ def __init__(self, fig: go.Figure):
4141 """Initialize ButtonManager."""
4242 self ._fig = fig
4343 self ._buttons = []
44- # Enable measurement tools by default
45- self ._enable_measurement_by_default ()
46-
47- def _enable_measurement_by_default (self ) -> None :
48- """Enable measurement tools in the modebar by default."""
49- self ._fig .update_layout (
50- modebar = {
51- "add" : ["drawline" , "drawopenpath" , "drawclosedpath" , "drawcircle" , "drawrect" , "eraseshape" ]
52- }
53- )
5444
5545 def add_button (self ,
5646 label : str ,
@@ -317,79 +307,12 @@ def add_plane_view_buttons(
317307 }
318308 ]
319309
320- self .add_dropdown_menu ("Camera Views" , view_options , x = x , y = y )
310+ self .add_dropdown_menu (view_options , x = x , y = y )
321311
322312 def _update_buttons (self ) -> None :
323313 """Update the figure layout with all buttons."""
324314 self ._update_dropdowns ()
325315
326- def clear_buttons (self ) -> None :
327- """Remove all buttons from the figure."""
328- self ._buttons .clear ()
329- self ._fig .update_layout (updatemenus = [])
330-
331- def add_visibility_toggle_button (
332- self ,
333- trace_indices : List [int ],
334- label : str = "Toggle Visibility" ,
335- x : float = 0.02 ,
336- y : float = 0.95
337- ) -> None :
338- """Add a button to toggle visibility of specific traces.
339-
340- Parameters
341- ----------
342- trace_indices : List[int]
343- List of indices of traces to toggle.
344- label : str, optional
345- The text to display on the button, by default "Toggle Visibility".
346- x : float, optional
347- X position of the button (0-1), by default 0.02.
348- y : float, optional
349- Y position of the button (0-1), by default 0.95.
350- """
351- # Create visibility arrays for toggle functionality
352- visible_true = [True if i in trace_indices else None for i in range (len (self ._fig .data ))]
353- visible_false = [False if i in trace_indices else None for i in range (len (self ._fig .data ))]
354-
355- self .add_button (
356- label = label ,
357- method = "restyle" ,
358- args = [{"visible" : visible_true }],
359- args2 = [{"visible" : visible_false }],
360- x = x ,
361- y = y
362- )
363-
364- def add_reset_view_button (
365- self ,
366- label : str = "Reset View" ,
367- x : float = 0.02 ,
368- y : float = 0.95
369- ) -> None :
370- """Add a button to reset the 3D view to default.
371-
372- Parameters
373- ----------
374- label : str, optional
375- The text to display on the button, by default "Reset View".
376- x : float, optional
377- X position of the button (0-1), by default 0.02.
378- y : float, optional
379- Y position of the button (0-1), by default 0.95.
380- """
381- self .add_button (
382- label = label ,
383- method = "relayout" ,
384- args = [{
385- "scene.camera.eye" : {"x" : 1.25 , "y" : 1.25 , "z" : 1.25 },
386- "scene.camera.center" : {"x" : 0 , "y" : 0 , "z" : 0 },
387- "scene.camera.up" : {"x" : 0 , "y" : 0 , "z" : 1 }
388- }],
389- x = x ,
390- y = y
391- )
392-
393316 def add_measurement_toggle_button (
394317 self ,
395318 label : str = "Toggle Measurement" ,
0 commit comments