Mercurial > repos > public > sbplib
changeset 745:00eb5db89da5 feature/grids
Fix bug in draw.promprt_point()
Problems with registering events,
Fixed by attaching events to the figure instead of the axis
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 28 Mar 2018 12:50:06 +0200 |
parents | 94bd0f3293c8 |
children | e95a0f2f7a8d |
files | +draw/prompt_point.m |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/+draw/prompt_point.m Wed Mar 28 12:47:53 2018 +0200 +++ b/+draw/prompt_point.m Wed Mar 28 12:50:06 2018 +0200 @@ -1,22 +1,23 @@ -function [p, button] = prompt_point(s,varargin) +function [p, button] = prompt_point(s, varargin) default_arg('s',[]) set(gcf,'Pointer','crosshair') if ~isempty(s) - fprintf(s,varargin{:}); + fprintf(s, varargin{:}); end - a = gca; + fh = gcf(); + ah = gca(); - function get_point(src,event) - cp = a.CurrentPoint; + function get_point(src, event) + cp = ah.CurrentPoint; p = cp(1,1:2)'; - a.ButtonDownFcn = []; + fh.WindowButtonUpFcn = []; end - a.ButtonDownFcn = @get_point; - waitfor(a,'ButtonDownFcn', []) + fh.WindowButtonUpFcn = @get_point; + waitfor(fh,'WindowButtonUpFcn', []) set(gcf,'Pointer','arrow')