Mercurial > repos > public > sbplib
annotate +draw/prompt_point.m @ 500:83734c26b8e3 feature/quantumTriangles
Small changes
| author | Ylva Rydin <ylva.rydin@telia.com> |
|---|---|
| date | Thu, 20 Apr 2017 07:55:09 +0200 |
| parents | 48b6fb693025 |
| children | 00eb5db89da5 |
| rev | line source |
|---|---|
| 0 | 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 |
