From f37b744ed56c68a3a935b71a03ccdfb06fbab0b8 Mon Sep 17 00:00:00 2001 From: Ben Whittaker Date: Mon, 4 Oct 2021 18:45:57 -0400 Subject: [PATCH] Layout: defer initial update until first render --- modules/Layout.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/Layout.js b/modules/Layout.js index 69f257b3b..087aff249 100644 --- a/modules/Layout.js +++ b/modules/Layout.js @@ -140,7 +140,7 @@ function Layout(layout, buttons, options) { if (l.c) l.c.forEach(idRecurser); } idRecurser(layout); - this.update(); + this.updateNeeded = true; } Layout.prototype.remove = function (l) { @@ -196,6 +196,7 @@ function prepareLazyRender(l, rectsToClear, drawList, rects, parentBg) { Layout.prototype.render = function (l) { if (!l) l = this._l; + if (this.updateNeeded) this.update(); function render(l) {"ram" g.reset(); @@ -309,6 +310,7 @@ Layout.prototype.debug = function(l,c) { if (l.c) l.c.forEach(n => this.debug(n,c)); }; Layout.prototype.update = function() { + delete this.updateNeeded; var l = this._l; var w = g.getWidth(); var y = this.yOffset;