Mercurial > repos > public > sbplib
comparison +draw/prompt_point.m @ 832:5573913a0949 feature/burgers1d
Merged with default, and updated +scheme/Burgers1D accordingly
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 11 Sep 2018 15:58:35 +0200 |
parents | 00eb5db89da5 |
children |
comparison
equal
deleted
inserted
replaced
831:d0934d1143b7 | 832:5573913a0949 |
---|---|
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 |