I have a small app designed using the App Designer. Matlab 2021b
The UI is constructed of Figure->UIAxes only and the UIAxes is much smaller from the Figure.
This is the code of thestartup function.
imshow('peppers.png', 'Parent', app.UIAxes);
h = drawrectangle(app.UIAxes)
There are two issues:
- While clicking the mouse outside the UIAxes and dragging , the app draws a line (i.e. rectangle with no width) on the UIAxes but outside the image. See attached.
- The rectangle can be drawn in the UIAxes but outside the image.See attached.
While using imrect(app.UIAxes) instead, the rectangle can be drawn on the image only. Mouse events outside the image are ignored.
How can I make the drawrectangle work as the imrect? (creating rectangle by clicking on the image only)