scrolling improvements

This commit is contained in:
Michael Freno
2025-12-05 19:49:57 -05:00
parent c59f7c5661
commit f4dc92907c
10 changed files with 619 additions and 52 deletions

View File

@@ -132,6 +132,7 @@
---@field scrollbarRadius number? -- Scrollbar corner radius
---@field scrollbarPadding number? -- Scrollbar padding from edges
---@field scrollSpeed number? -- Scroll speed multiplier
---@field scrollBarStyle string? -- Scrollbar style name from theme (selects from theme.scrollbars)
---@field _overflowX boolean? -- Internal: whether content overflows horizontally
---@field _overflowY boolean? -- Internal: whether content overflows vertically
---@field _contentWidth number? -- Internal: total content width
@@ -1423,6 +1424,8 @@ function Element.new(props)
scrollbarRadius = props.scrollbarRadius,
scrollbarPadding = props.scrollbarPadding,
scrollSpeed = props.scrollSpeed,
smoothScrollEnabled = props.smoothScrollEnabled,
scrollBarStyle = props.scrollBarStyle,
hideScrollbars = props.hideScrollbars,
_scrollX = props._scrollX,
_scrollY = props._scrollY,
@@ -1438,6 +1441,7 @@ function Element.new(props)
self.scrollbarRadius = self._scrollManager.scrollbarRadius
self.scrollbarPadding = self._scrollManager.scrollbarPadding
self.scrollSpeed = self._scrollManager.scrollSpeed
self.scrollBarStyle = self._scrollManager.scrollBarStyle
self.hideScrollbars = self._scrollManager.hideScrollbars
-- Initialize state properties (will be synced from ScrollManager)
@@ -2212,6 +2216,12 @@ function Element:update(dt)
self._textEditor:update(self, dt)
end
-- Update scroll manager for smooth scrolling and momentum
if self._scrollManager then
self._scrollManager:update(dt)
self:_syncScrollManagerState()
end
-- Update animation if exists
if self.animation then
-- Ensure animation has Color module reference for color interpolation