Skip to content

Commit 76d8e70

Browse files
committed
Adaptation for R2019a in getWebElements() for uiaxes inputs
In R2019a a <img> node is returned, as opposed to earlier versions, in which <canvas> would be returned.
1 parent 5a52ddd commit 76d8e70

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

mlapptools.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,19 @@ function fontWeight(hUIElement, weight)
305305
widgetID = arrayfun(@(x)WidgetID(mlapptools.DEF_ID_ATTRIBUTE, x), ...
306306
string(tmp.id(contains(tmp.id, TAB_PREFIX))));
307307
case 'axes'
308-
% For uiaxes we return the <canvas> object. This canvas has a context
309-
% of type "webgl".
310-
% See also: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
311-
warning(['UIAxes object detected. Returning the innermost <canvas> element. '...
308+
switch subsref(ver('matlab'), substruct('.','Version'))
309+
case {'9.6'} % R2019a
310+
descendType = 'img';
311+
otherwise % R2016a-R2018b
312+
descendType = 'canvas';
313+
% This canvas has a context of type "webgl".
314+
% See also: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
315+
warning(['UIAxes object detected. Returning the innermost <canvas> element. '...
312316
'Be advised that mlapptools cannot modify this element, which '...
313-
'instead requires using WebGL commands via `hWin.executeJS(...)`.']);
317+
'instead requires using WebGL commands via `hWin.executeJS(...)`.']);
318+
end
314319
widgetID = mlapptools.getDecendentOfType( ...
315-
hWin, mlapptools.getDataTag(hUIElement), 'canvas');
320+
hWin, mlapptools.getDataTag(hUIElement), descendType);
316321
otherwise % default:
317322
widgetID = mlapptools.getWidgetID(hWin, mlapptools.getDataTag(hUIElement));
318323
end

0 commit comments

Comments
 (0)