Point cloud rotate beyond plot limit (App Design based)

2 vues (au cours des 30 derniers jours)
Veronica Taurino
Veronica Taurino le 2 Mai 2022
Hello!
My app has two panels: on the left data input, on the right plot results. My problem is: the plot can be rotated even when the mouse cursor appears on the left panel. How can i prevent this? The user could accidentally rotate the plot when changing input data.
The plot parent is a grid, children of the right panel.
Thank you

Réponses (1)

Raghav Bansal
Raghav Bansal le 28 Déc 2023
Hi Veronica,
To prevent the plot from rotating when the mouse is over the left panel, you can use the 'WindowButtonMotionFcn' callback of the figure to detect the cursor's position and disable the rotation if the cursor is over the left panel. You'll need to determine the boundaries of the left panel in the figure's coordinate system and then check if the cursor's position is within those boundaries.
Here's a step-by-step approach you can follow:
  1. Determine the position and size of the left panel: You can get this information from the Position property of the panel.
  2. Set up the 'WindowButtonMotionFcn' callback for the figure: This callback will be executed whenever the mouse moves within the figure window.
  3. In the callback function, check the cursor's position. Use the 'CurrentPoint' property of the figure to get the cursor's position.
  4. Compare the cursor's position to the left panel's boundaries. If the cursor is within the left panel, disable the rotation interaction on the plot; otherwise, enable it.
Hope it helps!
Regards,
Raghav

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by