Mercurial > octave
changeset 32758:4168d91bc123
maint: merge stable to default
author | Rik <rik@octave.org> |
---|---|
date | Tue, 16 Jan 2024 14:25:38 -0800 |
parents | cf431b249f1e (current diff) d43bec544e8e (diff) |
children | ef42de7c85f7 |
files | |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/gui/getpixelposition.m Tue Jan 16 14:13:09 2024 +0100 +++ b/scripts/gui/getpixelposition.m Tue Jan 16 14:25:38 2024 -0800 @@ -37,7 +37,7 @@ ## is computed relative to the enclosing figure object. ## ## The return value @var{pos} is a 4-element vector with values -## @code{[ lower_left_X, lower_left_Y, width, height ]}. +## @code{[lower_left_X, lower_left_Y, width, height]}. ## ## @seealso{get} ## @end deftypefn @@ -48,23 +48,24 @@ print_usage (); endif - if (! isscalar (h) || ! ishghandle (h)) + if (! (isscalar (h) && ishghandle (h))) error ("getpixelposition: H must be a scalar graphics handle"); endif - if (! any (strcmp (get (h, "type"), {"uibuttongroup", "uicontrol", ... - "uitable", "uipanel", ... - "axes", "figure"}))) + if (! any (strcmp (get (h, "type"), + {"uibuttongroup", "uicontrol", "uitable", "uipanel", ... + "axes", "figure"}))) pos = zeros (1, 4); return; endif pos = __get_position__ (h, "pixels"); - if (rel_to_fig) - while (! isfigure (h)) - h = get (h, "parent"); - pos(1:2) += __get_position__ (h, "pixels")(1:2); + if (rel_to_fig && ! isfigure (h)) + hpar = get (h, "parent"); + while (! isfigure (hpar)) + pos(1:2) += __get_position__ (hpar, "pixels")(1:2); + hpar = get (hpar, "parent"); endwhile endif