comparison scripts/plot/util/print.m @ 28678:e44ab1089f61

print.m: Fix printing when some "units" properties are not "data" (bug #59015). * print.m: Change findall() command to only locate "text" graphics objects and make sure the "units" property of these objects is set to "data" or "normalized".
author Rik <rik@octave.org>
date Thu, 03 Sep 2020 07:42:52 -0700
parents a57e52e4523a
children 3cac3ceb9629
comparison
equal deleted inserted replaced
28677:7db56a2694ae 28678:e44ab1089f61
472 props(1).name = "__printing__"; 472 props(1).name = "__printing__";
473 props(1).value = {"off"}; 473 props(1).value = {"off"};
474 set (opts.figure, "__printing__", "on"); 474 set (opts.figure, "__printing__", "on");
475 nfig += 1; 475 nfig += 1;
476 476
477 ## print() requires children of axes to have units = "normalized", or "data" 477 ## print() requires children of axes to have units = "normalized" or "data"
478 hobj = findall (opts.figure, "-not", "type", "figure", ... 478 ## FIXME: Bug #59015. The only graphics object type to which this
479 "-not", "type", "axes", "-property", "units", ... 479 ## requirement applies seems to be 'text' objects. It is simpler, and
480 ## clearer, to just select those objects. The old code is left commented
481 ## out until sufficient testing has been done.
482 ## Change made: 2020/09/02.
483 ##hobj = findall (opts.figure, "-not", "type", "figure", ...
484 ## "-not", "type", "axes", "-not", "type", "hggroup", ...
485 ## "-property", "units", ...
486 ## "-not", "units", "normalized", "-not", "units", "data");
487 ##hobj(strncmp (get (hobj, "type"), "ui", 2)) = [];
488
489 hobj = findall (opts.figure, "type", "text",
480 "-not", "units", "normalized", "-not", "units", "data"); 490 "-not", "units", "normalized", "-not", "units", "data");
481 hobj(strncmp (get (hobj, "type"), "ui", 2)) = []; 491 for n = 1:numel (hobj)
482 for n = 1:numel(hobj)
483 props(end+1).h = hobj(n); 492 props(end+1).h = hobj(n);
484 props(end).name = "units"; 493 props(end).name = "units";
485 props(end).value = {get(hobj(n), "units")}; 494 props(end).value = {get(hobj(n), "units")};
486 set (hobj(n), "units", "data"); 495 set (hobj(n), "units", "data");
487 nfig += 1; 496 nfig += 1;