How do I implement zooming using key presses while user is selecting points using GINPUT in MATLAB 7.4 (R2007a)?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have an application where the user needs to select several points from the figure. I am implementing this using the function GINPUT.
However, while selecting points using the mouse during the execution of GINPUT, I want to be able to zoom/pan the figure using key presses.
The KEYPRESSFCN callback does not fire while GINPUT is being executed. I am wondering how to implement this functionality.
Akzeptierte Antwort
MathWorks Support Team
am 21 Jan. 2010
It is possible to modify the function GINPUT so that while selecting points using mouse one can also use key presses to have more functionality like zoom/pan the figure.
GINPUT uses the function WAITFORBUTTONPRESS to wait until the user clicks the mouse or hits a key. As soon as these events occur the pointer locations are stored. This code can be modified by implementing a while loop which keeps on scanning for points until the user clicks the mouse, hits Ctrl+C, or hits Enter. The code can contain IF conditions to take appropriate keypress actions when the user hits other keys.
Please refer to the attached 'my_ginput' function which can zoom in/out when the user presses r/v while selecting points on the figure.
You can extend the WFBP subfunction in the file in a similar manner to implement panning functionality.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Visual Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!