regionZoomInteraction only works the first time, bug?

6 visualizzazioni (ultimi 30 giorni)
Pelajar UM
Pelajar UM il 31 Mag 2022
Risposto: Rahul il 20 Gen 2025 alle 6:02
So I noticed this very weird thing which I think is a bug...
When the switch is on by default, the regionZoom works as intended. Then I turn it off, and rotate and zoom starts to work. And turn it on again, now the regionZoom cursor shows, you can select the area, but it doesn't actually zoom.
It looks like regionZoom only works in the first instance. Second time onwards it doesn't work. ZoomInteraction still works and this issue only applies to regionZoom.
Any thoughts? Can I add regionZoom as a standard option in the axes toolbar? That would do the job too.
function ButtonPushed(app, event)
ax=app.UIAxes;
if app.Switch.Value == "Off"
ax.Interactions = [rotateInteraction zoomInteraction];
else
ax.Interactions = [regionZoomInteraction zoomInteraction] ;
end

Risposte (1)

Rahul
Rahul il 20 Gen 2025 alle 6:02
I understand that you require to change interactions while using a Switch component and Button callback in your App.
After creating a dummy app, according to the description given by you, I was able to understand the reason behind the behaviour.
According to the Limitations mentioned in the documentation of 'regionZoomInteraction', the interaction is not supported for charts in a 3-D view. Hence when the Switch component is turned 'off' and the 'rotateInteraction' is used, while rotating the axis, the plot shifts to a 3-D view. Hence when the Switch component is turned 'on' again the 'regionZoomInteraction' does not function as expected.
A possible workaround for this can be to restore to the 'Default View' of the axis by clicking the 'Home' or 'Rotate 3D' icon of the plot as shown below:
This will restore the axis to a 2D view and then the 'regionZoomInteraction' will work as expected.
Refer to the following MathWorks documentation to know more:
Thanks.

Categorie

Scopri di più su Create Custom UI Components in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by