diff options
author | Aylur <[email protected]> | 2025-01-23 23:09:18 +0100 |
---|---|---|
committer | Aylur <[email protected]> | 2025-01-23 23:09:18 +0100 |
commit | cee257694447f846b0fb6fb12c21532e088031fd (patch) | |
tree | 01ad777371eef72bf18b0ad227a2e15dfed7c364 /examples/gtk3/js/popover/Popover.tsx | |
parent | 9cadfed0e4e541b8a65f4083800da6bf25c965da (diff) |
update popover example #249
Diffstat (limited to 'examples/gtk3/js/popover/Popover.tsx')
-rw-r--r-- | examples/gtk3/js/popover/Popover.tsx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/examples/gtk3/js/popover/Popover.tsx b/examples/gtk3/js/popover/Popover.tsx index 29c61e3..38ea01e 100644 --- a/examples/gtk3/js/popover/Popover.tsx +++ b/examples/gtk3/js/popover/Popover.tsx @@ -19,9 +19,17 @@ type PopoverProps = Pick< onClose?(self: Widget.Window): void } +/** + * Full screen window widget where you can space the child widget + * using margins and alignment properties. + * + * NOTE: Child widgets will assume they can span across the full window width + * this means that setting `wrap` or `ellipsize` on labels for example will not work + * without explicitly setting its `max_width_chars` property. + * For a workaround see Popover2.tsx + */ export default function Popover({ child, - visible = false, marginBottom, marginTop, marginLeft, @@ -39,13 +47,7 @@ export default function Popover({ anchor={TOP | BOTTOM | LEFT | RIGHT} exclusivity={Astal.Exclusivity.IGNORE} onNotifyVisible={(self) => { - // instead of anchoring to all sides we set the width explicitly - // otherwise label wrapping won't work correctly without setting their width - if (self.visible) { - self.widthRequest = self.get_current_monitor().workarea.width - } else { - onClose?.(self) - } + if (!self.visible) onClose?.(self) }} // close when click occurs otside of child onButtonPressEvent={(self, event) => { |