Mercurial > repos > public > sbplib
comparison +draw/prompt_point.m @ 0:48b6fb693025
Initial commit.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Sep 2015 10:12:50 +0200 |
parents | |
children | 00eb5db89da5 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:48b6fb693025 |
---|---|
1 function [p, button] = prompt_point(s,varargin) | |
2 default_arg('s',[]) | |
3 | |
4 set(gcf,'Pointer','crosshair') | |
5 | |
6 if ~isempty(s) | |
7 fprintf(s,varargin{:}); | |
8 end | |
9 | |
10 a = gca; | |
11 | |
12 function get_point(src,event) | |
13 cp = a.CurrentPoint; | |
14 p = cp(1,1:2)'; | |
15 a.ButtonDownFcn = []; | |
16 end | |
17 | |
18 a.ButtonDownFcn = @get_point; | |
19 waitfor(a,'ButtonDownFcn', []) | |
20 | |
21 set(gcf,'Pointer','arrow') | |
22 | |
23 end |