feat: scrollbar balance

This commit is contained in:
Michael Freno
2026-01-06 00:18:18 -05:00
parent ce690aa5dc
commit 1024fd81de
5 changed files with 123 additions and 8 deletions

View File

@@ -141,6 +141,7 @@
---@field scrollBarStyle string? -- Scrollbar style name from theme (selects from theme.scrollbars)
---@field scrollbarKnobOffset number|table? -- Scrollbar knob/handle offset (number or {x, y} or {horizontal, vertical})
---@field scrollbarPlacement string? -- "reserve-space"|"overlay" -- Whether scrollbar reserves space or overlays content (default: "reserve-space")
---@field scrollbarBalance boolean? -- When true, reserve space on both sides of content for visual balance (default: false)
---@field _overflowX boolean? -- Internal: whether content overflows horizontally
---@field _overflowY boolean? -- Internal: whether content overflows vertically
---@field _contentWidth number? -- Internal: total content width
@@ -1941,6 +1942,7 @@ function Element.new(props)
scrollbarKnobOffset = props.scrollbarKnobOffset,
hideScrollbars = props.hideScrollbars,
scrollbarPlacement = props.scrollbarPlacement,
scrollbarBalance = props.scrollbarBalance,
_scrollX = props._scrollX,
_scrollY = props._scrollY,
}, scrollManagerDeps)
@@ -1960,6 +1962,7 @@ function Element.new(props)
self.scrollbarKnobOffset = self._scrollManager.scrollbarKnobOffset
self.hideScrollbars = self._scrollManager.hideScrollbars
self.scrollbarPlacement = self._scrollManager.scrollbarPlacement
self.scrollbarBalance = self._scrollManager.scrollbarBalance
-- Initialize state properties (will be synced from ScrollManager)
self._overflowX = false