How to enable zooming only when the scroll is rotating?
Show older comments
Hello all.
I have a script that tries to enable the zoom in/out when the mouse wheel is scrolled only. In the following example, the zoom is open when I scroll and remains for 1.0 sec before turning off again.
I am wondering if there is a way to construct MATLAB to allow the zoom only if the wheel is scrolling, and disables the zoom once I stop the scroll, instead of doing it for 1.0 second each.
rgbImage = imread("peppers.png");
imshow(rgbImage)
hFig = gcf;
set(hFig, 'WindowScrollWheelFcn', @scrollCb)
function scrollCb(varargin)
% This function enables zooming in/out for one second before disabeling it again
zoom on;
pause(1.0);
zoom off;
end
Please advise.
Thanks a lot
1 Comment
Ahmad Gad
on 20 Sep 2022
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!