wid_edit: "highlight" hidden widgets when editing
parent
d28f2c6236
commit
e8de7aa662
|
|
@ -65,10 +65,27 @@
|
||||||
* Draw highlighted widget
|
* Draw highlighted widget
|
||||||
*/
|
*/
|
||||||
function highlight() {
|
function highlight() {
|
||||||
if (WIDGET.width) {
|
if (WIDGET.width > 0) {
|
||||||
|
// draw widget, then draw a highlighted border on top
|
||||||
WIDGET.draw();
|
WIDGET.draw();
|
||||||
g.setColor(g.theme.fgH)
|
g.setColor(g.theme.fgH)
|
||||||
.drawRect(WIDGET.x, WIDGET.y, WIDGET.x+WIDGET.width-1, WIDGET.y+23);
|
.drawRect(WIDGET.x, WIDGET.y, WIDGET.x+WIDGET.width-1, WIDGET.y+23);
|
||||||
|
} else {
|
||||||
|
// hidden widget: fake a width and provide our own draw()
|
||||||
|
const draw = WIDGET.draw, width = WIDGET.width;
|
||||||
|
WIDGET.width = 24;
|
||||||
|
WIDGET.draw = function() {
|
||||||
|
g.setColor(g.theme.bgH).setColor(g.theme.fgH)
|
||||||
|
.clearRect(this.x, this.y, this.x+23, this.y+23)
|
||||||
|
.drawRect(this.x, this.y, this.x+23, this.y+23)
|
||||||
|
.drawLine(this.x, this.y, this.x+23, this.y+23)
|
||||||
|
.drawLine(this.x, this.y+23, this.x+23, this.y);
|
||||||
|
};
|
||||||
|
// re-layout+draw all widgets with our placeholder in between
|
||||||
|
redrawWidgets();
|
||||||
|
// and restore original values
|
||||||
|
WIDGET.draw = draw;
|
||||||
|
WIDGET.width = width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
highlight();
|
highlight();
|
||||||
|
|
@ -108,12 +125,9 @@
|
||||||
const menu = {
|
const menu = {
|
||||||
"": {"title": name(id)},
|
"": {"title": name(id)},
|
||||||
/*LANG*/"< Back": () => {
|
/*LANG*/"< Back": () => {
|
||||||
if (WIDGET.width) {
|
redrawWidgets();
|
||||||
g.reset().clearRect(WIDGET.x, WIDGET.y, WIDGET.x+WIDGET.width-1, WIDGET.y+23);
|
|
||||||
WIDGET.draw();
|
|
||||||
}
|
|
||||||
mainMenu();
|
mainMenu();
|
||||||
},
|
},
|
||||||
/*LANG*/"Side": {
|
/*LANG*/"Side": {
|
||||||
value: (area === 'tl'),
|
value: (area === 'tl'),
|
||||||
format: tl => tl ? /*LANG*/"Left" : /*LANG*/"Right",
|
format: tl => tl ? /*LANG*/"Left" : /*LANG*/"Right",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue