Stop group selection on unsuitable sections
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
module Dodge.Update.Input.InGame (
|
||||
updateUseInputInGame,
|
||||
updateMouseInGame,
|
||||
@@ -159,16 +160,25 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
(yss, _) = IM.split (max i j + 1) xss
|
||||
return . IM.keysSet $ yss
|
||||
|
||||
isGroupSelectableSection :: Int -> Bool
|
||||
isGroupSelectableSection = \case
|
||||
0 -> True
|
||||
3 -> True
|
||||
_ -> False
|
||||
|
||||
updateMouseClickInGame :: Configuration -> World -> World
|
||||
updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
MouseInGame -> fromMaybe w $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
ysel <- inverseSelSecYint (posSelSecYint cfig ldp (mpos ^. _y)) sss
|
||||
guard (isGroupSelectableSection $ fst ysel)
|
||||
return $
|
||||
w & input . mouseContext
|
||||
.~ OverInvDragSelect ysel Nothing
|
||||
OverInvSelect x | ScancodeLShift `M.member` (w ^. input . pressedKeys )
|
||||
-> w & input . mouseContext .~ OverInvDragSelect x (Just $ snd x)
|
||||
-> fromMaybe w $ do
|
||||
guard (isGroupSelectableSection $ fst x)
|
||||
return $ w & input . mouseContext .~ OverInvDragSelect x (Just $ snd x)
|
||||
OverInvSelect x -> startDrag x cfig w
|
||||
OverTerminalReturn tmid -> terminalReturnEffect tmid w
|
||||
OverTerminalEscape ->
|
||||
|
||||
Reference in New Issue
Block a user