-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Milestone
Description
Why doesn't this make the area higher on keypresses? (No visual change whatsoever)
'use strict';
const libui = require('..');
const solidBrush = new libui.DrawBrush();
solidBrush.type = libui.brushType.solid;
solidBrush.color = new libui.Color(1, 0, 0, 1);
const solidBrush2 = new libui.DrawBrush();
solidBrush2.type = libui.brushType.solid;
solidBrush2.color = new libui.Color(0.5, 0.5, 0.5, 1);
const width = 400;
let height = 100;
function handlerDraw(area, p) {
let path = new libui.UiDrawPath(libui.fillMode.winding);
path.addRectangle(0, 0, width, height);
path.end();
p.getContext().fill(path, solidBrush2);
path.freePath();
path = new libui.UiDrawPath(libui.fillMode.winding);
path.addRectangle(20, 230, 100, 100);
path.end();
p.getContext().fill(path, solidBrush);
path.freePath();
}
function noop() {}
function main() {
const mainwin = new libui.UiWindow('libui textDrawArea Example', 400, 400, 1);
mainwin.margined = true;
mainwin.onClosing(() => {
mainwin.close();
libui.stopLoop();
});
const textDrawArea = new libui.UiArea(handlerDraw, noop, noop, noop,
() => {
height += 20;
console.log(height);
textDrawArea.setSize(width, height);
}, width, height);
const wrapper = new libui.UiVerticalBox();
wrapper.append(textDrawArea, true);
mainwin.setChild(wrapper);
mainwin.show();
libui.startLoop();
}
main();Metadata
Metadata
Assignees
Labels
No labels