Refresh mouse over in menu instantly

This commit is contained in:
2023-05-15 15:08:25 +01:00
parent 05bc7c6655
commit 63c71c852d
2 changed files with 8 additions and 7 deletions
+6 -5
View File
@@ -42,15 +42,14 @@ optionScreenUpdate ::
optionScreenUpdate screen u = optionScreenUpdate screen u =
(uvScreenLayers . ix 0 . scDisplayTime +~ 1) (uvScreenLayers . ix 0 . scDisplayTime +~ 1)
. refreshOptionsSelectionList . refreshOptionsSelectionList
. mouseOverSelectionList
. optionScreenDefaultEffect mop . optionScreenDefaultEffect mop
. mouseClickOptionsList screen . mouseClickOptionsList screen
. mouseOverSelectionList ldps screen
. menuWheelEvents . menuWheelEvents
. over (uvScreenLayers . _head) (setSelectionListRestriction (u ^. uvConfig)) . over (uvScreenLayers . _head) (setSelectionListRestriction (u ^. uvConfig))
$ u $ u
where where
mop = _scPositionedMenuOption screen mop = _scPositionedMenuOption screen
ldps = _scListDisplayParams screen
optionScreenDefaultEffect :: EscapeMenuOption -> Universe -> Universe optionScreenDefaultEffect :: EscapeMenuOption -> Universe -> Universe
optionScreenDefaultEffect f u = optionScreenDefaultEffect f u =
@@ -79,8 +78,11 @@ mouseClickOptionsList screen u = fromMaybe u $ do
return $ f u return $ f u
_ -> u _ -> u
mouseOverSelectionList :: ListDisplayParams -> ScreenLayer -> Universe -> Universe mouseOverSelectionList :: Universe -> Universe
mouseOverSelectionList ldps screen u = fromMaybe u $ do mouseOverSelectionList u = fromMaybe u $ do
screen <- u ^? uvScreenLayers . ix 0
ldps <- screen ^? scListDisplayParams
let ymax = maybe 0 length $ screen ^? scSelectionList . slItems
yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos) yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos)
guard $ mmoving || (_scDisplayTime screen <= 1) guard $ mmoving || (_scDisplayTime screen <= 1)
let myi = do let myi = do
@@ -91,7 +93,6 @@ mouseOverSelectionList ldps screen u = fromMaybe u $ do
isselectable yi = isselectable yi =
fromMaybe False $ fromMaybe False $
u ^? uvScreenLayers . _head . scSelectionList . slItems . ix yi . siIsSelectable u ^? uvScreenLayers . _head . scSelectionList . slItems . ix yi . siIsSelectable
ymax = maybe 0 length $ screen ^? scSelectionList . slItems
mmoving = u ^. uvWorld . input . mouseMoving mmoving = u ^. uvWorld . input . mouseMoving
ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int
+2 -2
View File
@@ -103,8 +103,8 @@ terminalWheelEvent yi tmid w
scrollRBOption :: Int -> Int -> Int -> Int scrollRBOption :: Int -> Int -> Int -> Int
scrollRBOption dy ymax scrollRBOption dy ymax
| dy < 0 = (min (ymax -1) . subtract dy) | dy < 0 = min (ymax -1) . subtract dy
| dy > 0 = (max 0 . subtract dy) | dy > 0 = max 0 . subtract dy
| otherwise = id | otherwise = id
moveTweakSel :: Int -> World -> World moveTweakSel :: Int -> World -> World