Mercurial > repos > public > sbplib
comparison +draw/prompt_point.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 15 Nov 2018 16:36:21 -0800 |
parents | 00eb5db89da5 |
children |
comparison
equal
deleted
inserted
replaced
816:b5e5b195da1e | 886:8894e9c49e40 |
---|---|
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 |