Fix dragging over items larger than the selection group

There is still a further choice/improvement to be made here,
but at least dragging shouldn't glitch out as it currently stands
This commit is contained in:
2024-11-25 11:09:58 +00:00
parent 905be15a33
commit 2c6037d852
6 changed files with 170 additions and 140 deletions
+6 -3
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 i _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDrag i _ _ _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDragSelect{} -> u
_ -> u & uvWorld . input . mouseContext
.~ fromMaybe
@@ -335,10 +335,13 @@ updateMouseContext cfig u = case u ^. uvWorld . input . mouseContext of
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
| otherwise = MouseInGame
mpos = w ^. input . mousePos
invdrag i' = fromMaybe (OverInvDrag i' Nothing) $ do
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
return $ OverInvDrag i' (Just (i,j))
let above = inverseSelSecYint (yint - 1) sss
bneath = inverseSelSecYint (yint + 1) sss
return $ OverInvDrag i' (Just (i,j)) above bneath
overinv = do
sss <- w ^? hud . hudElement . diSections
selpos <- inverseSelNumPos cfig (invDisplayParams w) sss mpos