Allow more drag selection to work
This commit is contained in:
@@ -100,11 +100,17 @@ updateMouseHeldInGame :: Configuration -> World -> World
|
||||
updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
|
||||
OverInvDragSelect {} | ButtonRight `M.member` (w ^. input . mouseButtons)
|
||||
-> w & input . mouseContext .~ MouseGameRotate
|
||||
OverInvDragSelect sstart _ -> fromMaybe w $ do
|
||||
OverInvDragSelect (Just sstart) _ -> fromMaybe w $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
let msel = inverseSelNumPos cfig invDP sss (w ^. input . mousePos)
|
||||
guard $ Just (fst sstart) == fmap fst msel || isNothing msel
|
||||
guard $ Just (fst sstart) == fmap fst msel
|
||||
return $ w & input . mouseContext . mcoSelEnd .~ fmap snd msel
|
||||
OverInvDragSelect Nothing _ -> fromMaybe w $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
ysel <- inverseSelSecYint
|
||||
(posSelSecYint cfig invDP (w ^. input . mousePos . _y)) sss
|
||||
guard (isGroupSelectableSection $ fst ysel)
|
||||
return $ w & input . mouseContext .~ OverInvDragSelect (Just ysel) Nothing
|
||||
OverInvDrag k mmouseover ab bn -> doDrag 30 k mmouseover ab bn w
|
||||
_ -> w
|
||||
|
||||
@@ -157,7 +163,7 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
OverInvDrag k mpos _ _ ->
|
||||
input . mouseContext .~ MouseInGame $
|
||||
fromMaybe w $ tryDropSelected mpos w <|> tryPickupSelected k mpos w
|
||||
OverInvDragSelect ssel mesel
|
||||
OverInvDragSelect (Just ssel) mesel
|
||||
| ScancodeLShift `M.member` (w ^. input . pressedKeys) ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& hud . hudElement . diSelection . _Just . _3
|
||||
@@ -172,9 +178,12 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
OverInvDragSelect _ Nothing ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& hud . hudElement . diSelection . _Just . _3 %~ const mempty
|
||||
OverInvDragSelect ssel (Just esel) ->
|
||||
OverInvDragSelect (Just ssel) (Just esel) ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& invSetSelection (f (fst ssel, esel) (h ssel esel))
|
||||
OverInvDragSelect Nothing _ ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& hud . hudElement . diSelection . _Just . _3 %~ const mempty
|
||||
_ -> w
|
||||
where
|
||||
getuniques x y = IS.union x y IS.\\ IS.intersection x y
|
||||
@@ -193,12 +202,12 @@ isGroupSelectableSection = \case
|
||||
|
||||
updateMouseClickInGame :: Configuration -> World -> World
|
||||
updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
MouseInGame -> fromMaybe w $ do
|
||||
MouseInGame -> fromMaybe (w & input . mouseContext .~ OverInvDragSelect Nothing Nothing) $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
ysel <- inverseSelSecYint
|
||||
(posSelSecYint cfig invDP (w ^. input . mousePos . _y)) sss
|
||||
guard (isGroupSelectableSection $ fst ysel)
|
||||
return $ w & input . mouseContext .~ OverInvDragSelect ysel Nothing
|
||||
return $ w & input . mouseContext .~ OverInvDragSelect (Just ysel) Nothing
|
||||
OverInvSelect (-1, _)
|
||||
| selsec == Just (-1) ->
|
||||
w
|
||||
@@ -212,7 +221,7 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
OverInvSelect x
|
||||
| ScancodeLShift `M.member` (w ^. input . pressedKeys)
|
||||
&& isGroupSelectableSection (fst x) ->
|
||||
w & input . mouseContext .~ OverInvDragSelect x (Just $ snd x)
|
||||
w & input . mouseContext .~ OverInvDragSelect (Just x) (Just $ snd x)
|
||||
OverInvSelect x -> startDrag x cfig w
|
||||
OverTerminal tmid TerminalTextInput{} -> terminalReturnEffect tmid w
|
||||
OverTerminal tmid TerminalPressTo{} -> continueTerminal tmid w
|
||||
|
||||
Reference in New Issue
Block a user