# HG changeset patch # User Mike Miller # Date 1426437665 14400 # Node ID 6e5365ee200a624f5b4f9540053794e6b6e42548 # Parent 4910b70d73284dd4388aec081ee4387b6257d57d ginput: Fix for clicks outside axes and within multiple axes (bug #44426) * ginput.m: Use the figure "windowbuttondownfcn" callback instead of the axes "buttondownfcn" callback. Get mouse click coordinates from gca. diff -r 4910b70d7328 -r 6e5365ee200a scripts/plot/util/ginput.m --- a/scripts/plot/util/ginput.m Sun Mar 15 12:34:39 2015 -0400 +++ b/scripts/plot/util/ginput.m Sun Mar 15 12:41:05 2015 -0400 @@ -64,12 +64,12 @@ x = y = button = []; ginput_accumulator (0, 0, 0, 0); # initialize accumulator - orig_buttondownfcn = get (fig, "buttondownfcn"); + orig_windowbuttondownfcn = get (fig, "windowbuttondownfcn"); orig_ginput_keypressfcn = get (fig, "keypressfcn"); unwind_protect - set (ax, "buttondownfcn", @ginput_buttondownfcn); + set (fig, "windowbuttondownfcn", @ginput_windowbuttondownfcn); set (fig, "keypressfcn", @ginput_keypressfcn); do @@ -91,7 +91,7 @@ endif unwind_protect_cleanup - set (ax, "buttondownfcn", orig_buttondownfcn); + set (fig, "windowbuttondownfcn", orig_windowbuttondownfcn); set (fig, "keypressfcn", orig_ginput_keypressfcn); end_unwind_protect @@ -119,8 +119,8 @@ endfunction -function ginput_buttondownfcn (src, button) - point = get (src, "currentpoint"); +function ginput_windowbuttondownfcn (src, button) + point = get (gca (), "currentpoint"); ginput_accumulator (1, point(1,1), point(1,2), button); endfunction