The text.Extent property reports inconsistent values
Mostrar comentarios más antiguos
Does anybody know why the Extent property of a TEXT object in a uiaxes reports the wrong value?
The code snippet below demonstrates the problem. It creates a text object which reports
textobj.Extent = [1 1 52.545 19]
but after calling redraw it has changed to
textobj.Extent = [1 1 65 23].
The redraw event has mysteriously changed the width and height of the Extent. Does anybody know why??
I am using Matlab R2019b.
% construct a new figur
fig = uifigure();
% construct a new axes
ax = uiaxes(fig, 'Units','pixels');
% add a text object to the axes
textobj = text(ax,1,1, ...
'x = \int y', ...
'Units','pixels', ...
'FontUnits','pixels', ...
'FontSize',16, ...
'VerticalAlignment','bottom');
% Here the Extent is reported as [1 1 52.5450 19.0000]
textobj.Extent
% Force a redraw of the graphics
drawnow;
% Here the Extent is reported as [1 1 65 23]
textobj.Extent
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Scripts en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!