fix(w.w.template) draw

The draw method exists only for widgets. When dealing with more complex
widget, this method is not necessary implemented (i.e. with layouts).

We need to check the method is defined by the child before calling it.
This commit is contained in:
Aire-One 2021-11-11 19:28:49 +01:00 committed by Emmanuel Lepage Vallee
parent f12bb57c66
commit cd5dda385e
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ function template:fit(context, width, height)
end end
function template:draw(...) function template:draw(...)
return self._private.widget:draw(...) if type(self._private.widget.draw) == "function" then
return self._private.widget:draw(...)
end
end end
function template:_do_update_now() function template:_do_update_now()