lockPointer

버전 1.0.0.0 (888 Bytes) 작성자: Marc Jakobi
Locks the cursor horizontally or vertically
다운로드 수: 28
업데이트 날짜: 2017/2/6

라이선스 보기

LOCKPOINTER: Add this to a listener for a figure's 'WindowMouseMotion'
event to lock the cursor horizontally or vertically.
Syntax: setPointer(xp, axis)
xp: pointer pixel position of format [x, y]
axis: 'x' to lock to vertical line (locks x position)
'y' to lock to horizontal line (locks y position)

Usage example:

fig = figure;
ax = axes;
[xx(2), yy(2)] = ginput(1);
x_p = get(0, 'PointerLocation');
% other code here
hL = addlistener(fig,'WindowMouseMotion', @(x, y) lockPointer(x_p, 'x'));
[xx(1), yy(1)] = ginput(1);
delete(hL)

Author: Marc Jakobi, 07. February 2017

Note: If somebody has a tip for a significant performance improvement to make the above example less jittery, please let me know. Leaving out the strcmp(axes) check does not make a noticeable difference on my machine.

인용 양식

Marc Jakobi (2024). lockPointer (https://www.mathworks.com/matlabcentral/fileexchange/61469-lockpointer), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2016b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0