From 180df0db0904ac8a0fd4070d0f2f320358d04a88 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 14 May 2024 17:33:20 -0300 Subject: fix context menu not detecting scroll bar appropriately --- ui.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ui.js b/ui.js index 20d7381..3d66ce8 100644 --- a/ui.js +++ b/ui.js @@ -5086,16 +5086,30 @@ class ContextMenu extends FocusElement { width += 2 // Space for the pane border height += 2 // Space for the pane border - if (this.form.scrollBarShown) width++ + + // Hilarity time: at THIS point, we can't identify if the form has its + // scroll bar visible, because we haven't constrained the height of the + // form. We're going to apply all the dimensions leading to the form twice, + // adapting the second time to be one wider if the form shows its scroll + // bar the first time. + this.w = width this.h = height - this.fitToParent() this.pane.fillParent() this.form.fillParent() this.form.fixLayout() + // We only need to update our own (and the descendants') width this time, + // because height won't have changed from the earlier measurement. + if (this.form.scrollBarShown) width++ + this.w = width + + this.pane.fillParent() + this.form.fillParent() + this.form.fixLayout() + // After everything else, do a second pass to apply the decided width // to every element, so that they expand to all be the same width. // In order to change the width of a button (which is what these elements -- cgit 1.3.0-6-gf8a5