Fix wid_edit draw() - pass WIDGET as first argument

When attempting to edit a widget whose `draw` function takes the widget as an argument, we get an exception from that `draw` function. This fixes that by catering for both APIs.

The back button widget expects this, as does [`widsleepstatus`], [`widlock`] and [`widlockunlock`].

There are other widgets ([`widmessages`], [`widbatpc`] and [`widalarmeta`]) which use something else for the first parameter, however these are type-checked and used to distinguish calls from `Bangle.drawWidgets()` and elsewhere.

[`widsleepstatus`]: 2f6862024d/apps/widsleepstatus/widget.js (L20)
[`widlock`]: 2f6862024d/apps/widlock/widget.js (L5)
[`widlockunlock`]: 2f6862024d/apps/widlockunlock/widget.js (L27)

[`widmessages`]: 2f6862024d/apps/widmessages/widget.js (L14)
[`widbatpc`]: 2f6862024d/apps/widbatpc/widget.js (L89)
[`widalarmeta`]: 2f6862024d/apps/widalarmeta/widget.js (L28)
master
Rob Pilling 2023-04-24 20:47:12 +01:00
parent 2f6862024d
commit 67d89761b5
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@
function highlight() {
if (WIDGET.width > 0) {
// draw widget, then draw a highlighted border on top
WIDGET.draw();
WIDGET.draw(WIDGET);
g.setColor(g.theme.fgH)
.drawRect(WIDGET.x, WIDGET.y, WIDGET.x+WIDGET.width-1, WIDGET.y+23);
} else {