Allow dragging after single click

This commit is contained in:
2024-11-25 12:40:45 +00:00
parent 348da9e6b6
commit 691ed23eb4
3 changed files with 26 additions and 19 deletions
+1 -1
View File
@@ -1 +1 @@
All good (593 modules, at 11:22:57) All good (593 modules, at 12:39:43)
+14 -7
View File
@@ -166,8 +166,12 @@ updateUniverseMid u = case _uvScreenLayers u of
. updateClouds . updateClouds
) )
(sl : _) -> u & updateUseInputOnScreen sl (sl : _) -> u & updateUseInputOnScreen sl
[] -> timeFlowUpdate . updateUseInputInGame $ over uvWorld [] ->
(updateMouseInGame (u ^. uvConfig)) u timeFlowUpdate . updateUseInputInGame $
over
uvWorld
(updateMouseInGame (u ^. uvConfig))
u
timeFlowUpdate :: Universe -> Universe timeFlowUpdate :: Universe -> Universe
timeFlowUpdate u = case u ^. uvWorld . timeFlow of timeFlowUpdate u = case u ^. uvWorld . timeFlow of
@@ -308,7 +312,8 @@ updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
OverInvDrag i _ _ _ -> u & uvWorld . input . mouseContext .~ invdrag i OverInvDrag i _ _ _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDragSelect{} -> u OverInvDragSelect{} -> u
_ -> u & uvWorld . input . mouseContext _ ->
u & uvWorld . input . mouseContext
.~ fromMaybe .~ fromMaybe
aimcontext aimcontext
(overmenu <|> overinv <|> overcomb <|> overterm) (overmenu <|> overinv <|> overcomb <|> overterm)
@@ -320,7 +325,11 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
_ -> fromMaybe MouseMenuCursor $ do _ -> fromMaybe MouseMenuCursor $ do
ldps <- screen ^? scListDisplayParams ldps <- screen ^? scListDisplayParams
let ymax = maybe 0 length $ screen ^? scSelectionList let ymax = maybe 0 length $ screen ^? scSelectionList
yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos) yi <-
ldpVerticalSelection
(u ^. uvConfig)
ldps
(u ^. uvWorld . input . mousePos)
guard (yi >= 0 && yi < ymax) guard (yi >= 0 && yi < ymax)
return $ return $
if isselectable yi if isselectable yi
@@ -329,7 +338,6 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
isselectable yi = isselectable yi =
fromMaybe False $ fromMaybe False $
u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable
-- mmoving = u ^. uvWorld . input . mouseMoving
w = u ^. uvWorld w = u ^. uvWorld
aimcontext aimcontext
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming | ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
@@ -364,8 +372,7 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
tm <- w ^? cWorld . lWorld . terminals . ix tmid tm <- w ^? cWorld . lWorld . terminals . ix tmid
return $ return $
if isOverTerminalScreen cfig tm mpos if isOverTerminalScreen cfig tm mpos
then then fromMaybe NoMouseContext $ do
fromMaybe NoMouseContext $ do
let s = tm ^. tmInput . tiText let s = tm ^. tmInput . tiText
guard $ not (null s) && _tmStatus tm == TerminalReady guard $ not (null s) && _tmStatus tm == TerminalReady
return $ OverTerminalReturn tmid return $ OverTerminalReturn tmid
+1 -1
View File
@@ -205,7 +205,7 @@ startDrag (a, b) cfig w = fromMaybe (augInvDirectSelect (a, b) $ setmichosen mem
setmichosen :: IS.IntSet -> World -> World setmichosen :: IS.IntSet -> World -> World
setmichosen x = setmichosen x =
(input . mouseContext .~ OverInvDrag a (Just (a, b)) above bneath) (input . mouseContext .~ OverInvDrag a (Just (a, b)) above bneath)
. (hud . hudElement . diSelectionExtra .~ x) . (hud . hudElement . diSelectionExtra .~ IS.insert b x)
above :: Maybe (Int,Int) above :: Maybe (Int,Int)
above = do above = do
sss <- w ^? hud . hudElement . diSections sss <- w ^? hud . hudElement . diSections