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