Mercurial > repos > public > sbplib
comparison +draw/prompt_point.m @ 781:69ab0e69f972 feature/interpolation
Merge with feature/grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 24 Jul 2018 20:14:29 -0700 |
parents | 00eb5db89da5 |
children |
comparison
equal
deleted
inserted
replaced
751:005a8d071da3 | 781:69ab0e69f972 |
---|---|
1 function [p, button] = prompt_point(s,varargin) | 1 function [p, button] = prompt_point(s, varargin) |
2 default_arg('s',[]) | 2 default_arg('s',[]) |
3 | 3 |
4 set(gcf,'Pointer','crosshair') | 4 set(gcf,'Pointer','crosshair') |
5 | 5 |
6 if ~isempty(s) | 6 if ~isempty(s) |
7 fprintf(s,varargin{:}); | 7 fprintf(s, varargin{:}); |
8 end | 8 end |
9 | 9 |
10 a = gca; | 10 fh = gcf(); |
11 ah = gca(); | |
11 | 12 |
12 function get_point(src,event) | 13 function get_point(src, event) |
13 cp = a.CurrentPoint; | 14 cp = ah.CurrentPoint; |
14 p = cp(1,1:2)'; | 15 p = cp(1,1:2)'; |
15 a.ButtonDownFcn = []; | 16 fh.WindowButtonUpFcn = []; |
16 end | 17 end |
17 | 18 |
18 a.ButtonDownFcn = @get_point; | 19 fh.WindowButtonUpFcn = @get_point; |
19 waitfor(a,'ButtonDownFcn', []) | 20 waitfor(fh,'WindowButtonUpFcn', []) |
20 | 21 |
21 set(gcf,'Pointer','arrow') | 22 set(gcf,'Pointer','arrow') |
22 | 23 |
23 end | 24 end |