Skip to content

Commit bafd370

Browse files
committed
fix(picking): add option on click/hover
1 parent d0e845e commit bafd370

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies = [
2323
"wslink>=2.5.7",
2424
"trame>=3.13.2",
2525
"trame-vuetify>=3.1",
26-
"trame-rca[turbo]>=2.5.1",
26+
"trame-rca[turbo]>=2.6",
2727
"pyproj>=3.6.1",
2828
"netCDF4>=1.6.5",
2929
"trame-dataclass >=2.0.2",

src/e3sm_quickview/view_panel.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,31 @@ def _build_ui(self):
150150
click=f"utils.quickview.capturePanel('{self.variable_name}')",
151151
style="transform: scale(0.75);",
152152
)
153+
self.state.setdefault("picking_mode", None)
154+
v3.VIconBtn(
155+
v_tooltip_bottom="'Extract information on click'",
156+
icon="mdi-cursor-default-click-outline",
157+
size="small",
158+
base_variant="plain",
159+
active_variant="tonal",
160+
click="picking_mode = (picking_mode === 'click' ? null : 'click')",
161+
active=("picking_mode === 'click'",),
162+
active_color="white",
163+
hide_overlay=True,
164+
rounded=False,
165+
)
166+
v3.VIconBtn(
167+
v_tooltip_bottom="'Extract information on hover'",
168+
icon="mdi-cursor-default-gesture-outline",
169+
size="small",
170+
base_variant="plain",
171+
active_variant="tonal",
172+
click="picking_mode = (picking_mode === 'hover' ? null : 'hover')",
173+
active=("picking_mode === 'hover'",),
174+
active_color="white",
175+
hide_overlay=True,
176+
rounded=False,
177+
)
153178

154179
v3.VSpacer()
155180
html.Div(
@@ -194,8 +219,11 @@ def _build_ui(self):
194219
enable_interaction=False,
195220
bounds=(self._bounds_key, (0, 0, 1, 1)),
196221
size=(self.update_size, "[$event]"),
222+
send_mouse_click=(
223+
f"picking_mode === 'click' && hover_info === '{self.variable_name}'",
224+
),
197225
send_mouse_move=(
198-
f"hover_info === '{self.variable_name}'",
226+
f"picking_mode === 'hover' && hover_info === '{self.variable_name}'",
199227
),
200228
v_on_wheel="window.scrollBy(0, $event.deltaY)",
201229
)

0 commit comments

Comments
 (0)