From 0d06739114ed3b37f838304b334295d6f93bf50d Mon Sep 17 00:00:00 2001 From: Sebastien Jourdain Date: Fri, 9 Dec 2022 16:35:15 -0700 Subject: [PATCH] docs(selection): Update pv selection with clear and click --- examples/07_paraview/Picking/pv_selection.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/07_paraview/Picking/pv_selection.py b/examples/07_paraview/Picking/pv_selection.py index 391bae93..3f668c1e 100644 --- a/examples/07_paraview/Picking/pv_selection.py +++ b/examples/07_paraview/Picking/pv_selection.py @@ -47,6 +47,11 @@ view = simple.Render() +def clear_selection(): + simple.ClearSelection() + ctrl.view_update() + + @ctrl.set("on_selection_change") def on_box_selection(event): fn = MODE_TO_METHOD[state.selection_mode] @@ -74,11 +79,18 @@ def on_mode_change(selection_mode, **kwargs): view.InteractionMode = "Selection" # Handle hover with live update - # => attempt to do hover selection... - # state.send_mouse = selection_mode in ["select_hover_point", "select_hover_cell"] + state.send_mouse = selection_mode in [ + "select_block", + "select_hover_point", + "select_hover_cell", + ] # if state.send_mouse: # asynchronous.create_task(animate()) + # Disable active mode + if selection_mode == "-": + state.selection_mode = None + # async def animate(): # while state.send_mouse: @@ -104,6 +116,8 @@ def on_mode_change(selection_mode, **kwargs): height=ICON_SIZE, width=ICON_SIZE, ) + with vuetify.VBtn(small=True, click=clear_selection, value="-"): + vuetify.VIcon("mdi-trash-can-outline", small=True) with layout.content: with vuetify.VContainer(fluid=True, classes="pa-0 fill-height"):