WindowButtonDownFcn vs zoom or pan

조회 수: 9 (최근 30일)
Giuela
Giuela 2020년 10월 1일
댓글: Ted Londner 2024년 8월 26일
In my figure I have some little images; I've implemented WindowButtonDownFcn so when I click on an image, I do something different according to the image selected
The cursor position is checked with WindowButtonMotionFcn
Practically, every little image simulates a button with its callback function. I do this because the graphical aspect of my figure is better, and I can have a 'button' of different shape instead of the square or rectangular button shape. Moreover, I don't have the button outline.
Im my figure I have also an axis, used to plot data.
When I activate the zoom or the panning, the WindowButtonDownFcn function doesn't work, my 'buttons' don't work anymore until I deactivate the zoom or the pan.
This behaviour there is also if I set the zoom (or panning) on programmatically.
Is there a way to avoid this behaviour? I need the WindowButtonDownFcn ALWAYS working.
Thank you
  댓글 수: 1
Ted Londner
Ted Londner 2024년 5월 28일
I'm encountering an issue similar to this one. I'd be interested to hear if Giuela's question was ever answered.

댓글을 달려면 로그인하십시오.

답변 (1개)

Samay Sagar
Samay Sagar 2024년 8월 26일
I have also faced a similar issue in the past.
When you assign a “WindowButtonDownFcn” callback to a “uifigure “in App Designer, it overrides the default mouse button behaviour for the entire app window. This can interfere with built-in interactive features such as zooming and panning.
Since MATLAB’s interactions depend on these callbacks, attempting to mix the two can result in unsupported and unpredictable behaviour.
You can consider using the “ImageClicked” callback function to execute your intended logic.

카테고리

Help CenterFile Exchange에서 Data Exploration에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by