Skip to content

Commit

Permalink
Merge pull request #123 from dragonly/master
Browse files Browse the repository at this point in the history
fix UiWindow.conContentSizeChanged in utils.js and example
  • Loading branch information
parro-it authored Sep 27, 2018
2 parents ab76d87 + 5a1210e commit 8e3bc58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions examples/control-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ libui.Ui.onShouldQuit(() => {
onClosing();
});

function onPositionChanged() {
status.text = `(${win.position.x}, ${win.position.y}) - (${win.contentSize.w} x ${win.contentSize.h})`;
function onContentSizeChanged() {
status.text = `window size: (${win.contentSize.w} x ${win.contentSize.h})`;
}

const updateValue = value => {
Expand Down Expand Up @@ -206,7 +206,7 @@ const winProps = {
width: 640,
height: 480,
onClosing,
onContentSizeChanged: onPositionChanged
onContentSizeChanged: onContentSizeChanged
};

win = window(
Expand Down Expand Up @@ -270,7 +270,7 @@ win = window(
stretchy: true
}),
area)))),
(status = label({stretchy: true, text: '(0, 0)'})));
(status = label({stretchy: true, text: `window size: (${winProps.width} x ${winProps.height})`})));

win.show();
libui.startLoop();
6 changes: 5 additions & 1 deletion examples/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ function window(
hasMenubar = false,
fullscreen = false,
borderless = false,
onClosing = null
onClosing = null,
onContentSizeChanged= null,
},
...children) {
const win = new libui.UiWindow(title, width, height, hasMenubar);
Expand All @@ -147,6 +148,9 @@ function window(
if (onClosing) {
win.onClosing(onClosing);
}
if (onContentSizeChanged) {
win.onContentSizeChanged(onContentSizeChanged)
}

win.setChild(wrapChildren(children));

Expand Down

0 comments on commit 8e3bc58

Please sign in to comment.