Improve mouse menu controls, tweak charmap
This commit is contained in:
+11
-5
@@ -92,15 +92,21 @@ gotoTerminal w = case _uvScreenLayers w of
|
||||
(InputScreen{} : _) -> w
|
||||
_ -> w & uvScreenLayers .:~ InputScreen T.empty "Enter command"
|
||||
|
||||
mouseClickOptionsList :: [MenuOption] -> SelectionList -> Maybe MenuOption -> Universe -> Universe
|
||||
mouseClickOptionsList mos sl mop u = case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
||||
mouseClickOptionsList :: [MenuOption] -> SelectionList -> Universe -> Universe
|
||||
mouseClickOptionsList mos sl u = case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
||||
Just False -> fromMaybe u $ do
|
||||
i <- sl ^. slSelPos
|
||||
si <- sl ^? slShownItems . ix i . _2
|
||||
return $ maybe u ($ u) $ case si of
|
||||
ListedSelectionItem j -> mos ^? ix j . moEff
|
||||
ScrollUpSelectionItem -> Just $ uvScreenLayers . _head . scSelectionList . slOffset %~ (min 0 . subtract 10)
|
||||
ScrollDownSelectionItem -> Just $ uvScreenLayers . _head . scSelectionList . slOffset +~ 10
|
||||
ScrollUpSelectionItem -> Just $ uvScreenLayers . _head . scSelectionList . slOffset %~ (max 0 . subtract 5)
|
||||
ScrollDownSelectionItem -> do
|
||||
maxlines <- sl ^? slSizeRestriction . maxSelectionLines
|
||||
alllines <- sl ^? slLength
|
||||
Just $ uvScreenLayers . _head . scSelectionList . slOffset %~
|
||||
(\x -> if x + maxlines - 2 >= alllines then 0 else x + maxlines - 2)
|
||||
DummySelectionItem -> Just id
|
||||
SpecialSelectionItem -> Just id
|
||||
_ -> u
|
||||
|
||||
mouseOverSelectionList :: SelectionList -> Universe -> Universe
|
||||
@@ -146,7 +152,7 @@ optionScreenUpdate :: [MenuOption] -> Maybe MenuOption -> OptionScreenFlag
|
||||
-> Universe -> Universe
|
||||
optionScreenUpdate mos mop _ sl u =
|
||||
optionScreenDefEff mop
|
||||
. mouseClickOptionsList mos sl mop
|
||||
. mouseClickOptionsList mos sl
|
||||
. mouseOverSelectionList sl
|
||||
. menuWheelEvents
|
||||
. over (uvScreenLayers . _head . scSelectionList) (setSelectionListRestriction cfig)
|
||||
|
||||
Reference in New Issue
Block a user