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)
+24 -17
View File
@@ -166,8 +166,12 @@ updateUniverseMid u = case _uvScreenLayers u of
. updateClouds
)
(sl : _) -> u & updateUseInputOnScreen sl
[] -> timeFlowUpdate . updateUseInputInGame $ over uvWorld
(updateMouseInGame (u ^. uvConfig)) u
[] ->
timeFlowUpdate . updateUseInputInGame $
over
uvWorld
(updateMouseInGame (u ^. uvConfig))
u
timeFlowUpdate :: Universe -> Universe
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
@@ -287,7 +291,7 @@ functionalUpdate u =
. over uvWorld updateRBList
. over uvWorld updateCloseObjects
. over uvWorld updateWheelEvents
-- . over uvWorld (updateMouseInventorySelection (u ^. uvConfig))
-- . over uvWorld (updateMouseInventorySelection (u ^. uvConfig))
. over uvWorld zoneClouds
. over uvWorld zoneCreatures
-- . over uvWorld updateInventorySelectionList
@@ -308,10 +312,11 @@ updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
OverInvDrag i _ _ _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDragSelect{} -> u
_ -> u & uvWorld . input . mouseContext
.~ fromMaybe
aimcontext
(overmenu <|> overinv <|> overcomb <|> overterm)
_ ->
u & uvWorld . input . mouseContext
.~ fromMaybe
aimcontext
(overmenu <|> overinv <|> overcomb <|> overterm)
where
overmenu = do
screen <- u ^? uvScreenLayers . ix 0
@@ -320,7 +325,11 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
_ -> fromMaybe MouseMenuCursor $ do
ldps <- screen ^? scListDisplayParams
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)
return $
if isselectable yi
@@ -329,7 +338,6 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
isselectable yi =
fromMaybe False $
u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable
-- mmoving = u ^. uvWorld . input . mouseMoving
w = u ^. uvWorld
aimcontext
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
@@ -338,10 +346,10 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
invdrag i' = fromMaybe (OverInvDrag i' Nothing Nothing Nothing) $ do
sss <- w ^? hud . hudElement . diSections
let yint = posSelSecYint cfig (invDisplayParams w) (mpos ^. _y)
(i,j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
(i, j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
let above = inverseSelSecYint (yint - 1) sss
bneath = inverseSelSecYint (yint + 1) sss
return $ OverInvDrag i' (Just (i,j)) above bneath
return $ OverInvDrag i' (Just (i, j)) above bneath
overinv = do
sss <- w ^? hud . hudElement . diSections
selpos <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
@@ -356,7 +364,7 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
let mpossel = inverseSelNumPos cfig secondColumnParams sss (w ^. input . mousePos)
return $ case mpossel of
Nothing -> OverCombEscape
Just (-1, i) | (-1,i) == msel -> OverCombFilter
Just (-1, i) | (-1, i) == msel -> OverCombFilter
Just x | x == msel -> OverCombCombine x
Just x -> OverCombSelect x
overterm = do
@@ -364,11 +372,10 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
tm <- w ^? cWorld . lWorld . terminals . ix tmid
return $
if isOverTerminalScreen cfig tm mpos
then
fromMaybe NoMouseContext $ do
let s = tm ^. tmInput . tiText
guard $ not (null s) && _tmStatus tm == TerminalReady
return $ OverTerminalReturn tmid
then fromMaybe NoMouseContext $ do
let s = tm ^. tmInput . tiText
guard $ not (null s) && _tmStatus tm == TerminalReady
return $ OverTerminalReturn tmid
else OverTerminalEscape
isOverTerminalScreen :: Configuration -> Terminal -> Point2 -> Bool
+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 x =
(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 = do
sss <- w ^? hud . hudElement . diSections