Skip to content

Commit 28eaa8e

Browse files
fix: Remove ball when unselecting the pick button
1 parent 650dc63 commit 28eaa8e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ansys/tools/visualization_interface/backends/pyvista/pyvista.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def focus_point_selection(self, actor: "pv.Actor") -> None:
376376
"""
377377
pt = self._pl.scene.picked_point
378378
sphere = pv.Sphere(center=pt, radius=0.1)
379-
self._pl.scene.add_mesh(sphere, color="red", name="focus_sphere_temp", reset_camera=False)
379+
self._picked_ball = self._pl.scene.add_mesh(sphere, color="red", name="focus_sphere_temp", reset_camera=False)
380380
self._pl.scene.set_focus(pt)
381381
self._pl.scene.render()
382382

@@ -433,6 +433,11 @@ def disable_hover(self):
433433
"""Disable hover capabilities in the plotter."""
434434
self._hover_widget.EnabledOff()
435435

436+
def disable_center_focus(self):
437+
"""Disable setting the focus of the camera to the picked point."""
438+
self._pl.scene.disable_picking()
439+
self._picked_ball.SetVisibility(False)
440+
436441
def __extract_kwargs(self, func_name: Callable, input_kwargs: Dict[str, Any]) -> Dict[str, Any]:
437442
"""Extracts the keyword arguments from a function signature and returns it as dict.
438443

src/ansys/tools/visualization_interface/backends/pyvista/widgets/pick_rotation_center.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def callback(self, state: bool) -> None:
7272
# Lazy import to avoid circular import
7373
if not state:
7474
self._text_actor.SetVisibility(0)
75-
self.plotter_helper.scene.disable_picking()
75+
self.plotter_helper.disable_center_focus()
7676
if self.plotter_helper._allow_picking:
7777
self.plotter_helper.enable_picking()
7878
elif self.plotter_helper._allow_hovering:

0 commit comments

Comments
 (0)