Continue improving mouse|inventory interface

This commit is contained in:
2024-11-21 21:04:07 +00:00
parent efef41c9e1
commit 1250e2442a
9 changed files with 165 additions and 148 deletions
+5 -5
View File
@@ -306,7 +306,7 @@ checkTermDist w = fromMaybe w $ do
updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
OverInvDrag {} -> u & uvWorld . input . mouseContext .~ invdrag
OverInvDrag i _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDragSelect{} -> u
_ -> u & uvWorld . input . mouseContext
.~ fromMaybe
@@ -335,10 +335,10 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
| otherwise = MouseInGame
mpos = w ^. input . mousePos
invdrag = fromMaybe (OverInvDrag Nothing) $ do
invdrag i' = fromMaybe (OverInvDrag i' Nothing) $ do
sss <- w ^? hud . hudElement . diSections
(0,j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
return $ OverInvDrag $ Just j
(i,j) <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
return $ OverInvDrag i' (Just (i,j))
overinv = do
sss <- w ^? hud . hudElement . diSections
selpos <- inverseSelNumPos cfig (invDisplayParams w) sss mpos
@@ -377,7 +377,7 @@ isOverTerminalScreen cfig _ (V2 x y) =
where
ldp = secondColumnParams
V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
s = (5 + 15 * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap))
s = 5 + 15 * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
-- the 15 is the length of list in the terminal display, don't change
-- without changing drawTerminalDisplay
ymin = ymax - s