forked from MarineBioAcousticsRC/Triton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_pointer.m
34 lines (30 loc) · 1.06 KB
/
set_pointer.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function old = set_pointer(varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% set_pointer.m
%
% Set the figure pointer and return the value of the current one.
% Contains a workaround for a known bug when the current pointer
% is 'fullcross'.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global HANDLES
if length(varargin) < 2
error('Expecing figure handle and cursor')
end
figH = varargin{end-1};
new = varargin{end};
old = get(figH, 'Pointer'); % return current value
if ~ strcmp(old, new) % Any need to actually change it?
if strcmp(old, 'fullcrosshair')
% fullcross will not always erase itself when the focus
% is on the current window. We select another window,
% set the pointer, hide the window, then restore focus.
% figure(HANDLES.fig.fullcrossbug);
set(figH, 'Pointer', new);
% set(HANDLES.fig.fullcrossbug, 'Visible', 'off');
figure(figH);
else
set(figH, 'Pointer', new); % Set new pointer type
end
end