From 6e05c2677b70b5f6f5a8a236604b783fc734acad Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Sun, 10 Dec 2017 19:02:41 -0800 Subject: [PATCH] Update Forms page sizes (fixes #35) --- Ooui.Forms/PlatformRenderer.cs | 14 ++++++++++++++ Ooui/Client.js | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Ooui.Forms/PlatformRenderer.cs b/Ooui.Forms/PlatformRenderer.cs index d555803..922d171 100644 --- a/Ooui.Forms/PlatformRenderer.cs +++ b/Ooui.Forms/PlatformRenderer.cs @@ -15,5 +15,19 @@ namespace Ooui.Forms { this.platform = platform; } + + protected override bool TriggerEventFromMessage (Message message) + { + if (message.TargetId == "window" && message.Key == "resize" && message.Value is Newtonsoft.Json.Linq.JObject j) { + var width = (double)j["width"]; + var height = (double)j["height"]; + Platform.Element.Style.Width = width; + Platform.Element.Style.Height = height; + return true; + } + else { + return base.TriggerEventFromMessage (message); + } + } } } diff --git a/Ooui/Client.js b/Ooui/Client.js index faac03a..605cb91 100644 --- a/Ooui/Client.js +++ b/Ooui/Client.js @@ -100,8 +100,8 @@ function ooui (rootElementPath) { function resizeHandler() { const em = { m: "event", - id: 42, - k: "window.resize", + id: "window", + k: "resize", v: getSize (), }; const ems = JSON.stringify (em);