From 83d85dd3e79d4906031b786310305acb621b218c Mon Sep 17 00:00:00 2001 From: dragonly Date: Tue, 7 Aug 2018 00:02:10 +0800 Subject: [PATCH 1/2] fix UiWindow.conContentSizeChanged in utils.js and example --- examples/control-gallery.js | 8 ++++---- examples/utils.js | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/control-gallery.js b/examples/control-gallery.js index 519e9b2..8c438a8 100644 --- a/examples/control-gallery.js +++ b/examples/control-gallery.js @@ -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 conContentSizeChanged() { + status.text = `window size: (${win.contentSize.w} x ${win.contentSize.h})`; } const updateValue = value => { @@ -206,7 +206,7 @@ const winProps = { width: 640, height: 480, onClosing, - onContentSizeChanged: onPositionChanged + onContentSizeChanged: conContentSizeChanged }; win = window( @@ -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(); diff --git a/examples/utils.js b/examples/utils.js index 605c4a2..5fb9a26 100644 --- a/examples/utils.js +++ b/examples/utils.js @@ -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); @@ -146,7 +147,10 @@ function window( if (onClosing) { win.onClosing(onClosing); - } + } + if (onContentSizeChanged) { + win.onContentSizeChanged(onContentSizeChanged) + } win.setChild(wrapChildren(children)); From 5a1210e19ad4e909b727e0eddfa8bcdf3b34c50a Mon Sep 17 00:00:00 2001 From: dragonly Date: Mon, 20 Aug 2018 10:39:49 +0800 Subject: [PATCH 2/2] fix typo and tabs --- examples/control-gallery.js | 4 ++-- examples/utils.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/control-gallery.js b/examples/control-gallery.js index 8c438a8..2dffcdc 100644 --- a/examples/control-gallery.js +++ b/examples/control-gallery.js @@ -53,7 +53,7 @@ libui.Ui.onShouldQuit(() => { onClosing(); }); -function conContentSizeChanged() { +function onContentSizeChanged() { status.text = `window size: (${win.contentSize.w} x ${win.contentSize.h})`; } @@ -206,7 +206,7 @@ const winProps = { width: 640, height: 480, onClosing, - onContentSizeChanged: conContentSizeChanged + onContentSizeChanged: onContentSizeChanged }; win = window( diff --git a/examples/utils.js b/examples/utils.js index 5fb9a26..8cd51a3 100644 --- a/examples/utils.js +++ b/examples/utils.js @@ -136,8 +136,8 @@ function window( hasMenubar = false, fullscreen = false, borderless = false, - onClosing = null, - onContentSizeChanged = null + onClosing = null, + onContentSizeChanged= null, }, ...children) { const win = new libui.UiWindow(title, width, height, hasMenubar); @@ -147,10 +147,10 @@ function window( if (onClosing) { win.onClosing(onClosing); - } - if (onContentSizeChanged) { - win.onContentSizeChanged(onContentSizeChanged) - } + } + if (onContentSizeChanged) { + win.onContentSizeChanged(onContentSizeChanged) + } win.setChild(wrapChildren(children));