mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-12 08:21:02 +02:00
commit o
This commit is contained in:
@@ -729,6 +729,15 @@ function ScrollManager:getState()
|
||||
_overflowY = self._overflowY,
|
||||
_contentWidth = self._contentWidth,
|
||||
_contentHeight = self._contentHeight,
|
||||
-- Touch fling state: without these, immediate-mode recreation zeroes the
|
||||
-- release velocity on the next frame and momentum scrolling never runs.
|
||||
_touchScrolling = self._touchScrolling or false,
|
||||
_momentumScrolling = self._momentumScrolling or false,
|
||||
_scrollVelocityX = self._scrollVelocityX or 0,
|
||||
_scrollVelocityY = self._scrollVelocityY or 0,
|
||||
_lastTouchTime = self._lastTouchTime or 0,
|
||||
_lastTouchX = self._lastTouchX or 0,
|
||||
_lastTouchY = self._lastTouchY or 0,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -834,6 +843,30 @@ function ScrollManager:setState(state)
|
||||
if state._targetScrollY ~= nil then
|
||||
self._targetScrollY = state._targetScrollY
|
||||
end
|
||||
|
||||
-- Touch fling state (see getState): restore so momentum survives
|
||||
-- immediate-mode element recreation between frames.
|
||||
if state._touchScrolling ~= nil then
|
||||
self._touchScrolling = state._touchScrolling
|
||||
end
|
||||
if state._momentumScrolling ~= nil then
|
||||
self._momentumScrolling = state._momentumScrolling
|
||||
end
|
||||
if state._scrollVelocityX ~= nil then
|
||||
self._scrollVelocityX = state._scrollVelocityX
|
||||
end
|
||||
if state._scrollVelocityY ~= nil then
|
||||
self._scrollVelocityY = state._scrollVelocityY
|
||||
end
|
||||
if state._lastTouchTime ~= nil then
|
||||
self._lastTouchTime = state._lastTouchTime
|
||||
end
|
||||
if state._lastTouchX ~= nil then
|
||||
self._lastTouchX = state._lastTouchX
|
||||
end
|
||||
if state._lastTouchY ~= nil then
|
||||
self._lastTouchY = state._lastTouchY
|
||||
end
|
||||
end
|
||||
|
||||
--- Handle touch press for scrolling
|
||||
|
||||
@@ -78,8 +78,13 @@ local function mk(props)
|
||||
if props.flexShrink == nil then
|
||||
props.flexShrink = isScrollOverflow(props) and 1 or 0
|
||||
end
|
||||
if isScrollOverflow(props) and props.minHeight == nil then
|
||||
props.minHeight = 0
|
||||
if isScrollOverflow(props) then
|
||||
if props.minHeight == nil then props.minHeight = 0 end
|
||||
-- Every launcher list scrolls like a native one: interpolated wheel
|
||||
-- steps instead of hard 20px jumps, and a bigger per-notch distance so
|
||||
-- long save/mod lists don't take dozens of notches to traverse.
|
||||
if props.smoothScrollEnabled == nil then props.smoothScrollEnabled = true end
|
||||
if props.scrollSpeed == nil then props.scrollSpeed = 60 end
|
||||
end
|
||||
-- Resolve "100%" here, against the parent's CONTENT width: the engine
|
||||
-- resolves a percentage against the parent's border box and ignores its
|
||||
|
||||
Reference in New Issue
Block a user