Improve drag inventory selection
This commit is contained in:
+4
-3
@@ -3,6 +3,7 @@
|
||||
|
||||
module Dodge.Update (updateUniverse) where
|
||||
|
||||
import Dodge.Data.CardinalPoint
|
||||
import Dodge.Data.ScreenPos
|
||||
import Bound
|
||||
import Color
|
||||
@@ -409,7 +410,7 @@ updateMouseContext cfig u = case u ^? uvScreenLayers . ix 0 of
|
||||
|
||||
updateMouseContextGame :: Config -> Universe -> MouseContext -> MouseContext
|
||||
updateMouseContextGame cfig u = \case
|
||||
OverInvDrag i _ -> OverInvDrag i (inverseSelNumPos cfig invDP mpos disss)
|
||||
OverInvDrag i _ -> OverInvDrag i (inverseSelNumPos cfig invDP mpos disss ^? _Just . nonInf)
|
||||
x@OverInvDragSelect{} -> x
|
||||
MouseGameRotate x
|
||||
| ButtonRight `M.member` (w ^. input . mouseButtons) -> MouseGameRotate x
|
||||
@@ -424,7 +425,7 @@ updateMouseContextGame cfig u = \case
|
||||
mpos = w ^. input . mousePos
|
||||
disss = w ^. hud . diSections
|
||||
overinv = do
|
||||
selpos@(i, j) <- inverseSelNumPos cfig invDP mpos disss
|
||||
selpos@(i, j) <- inverseSelNumPos cfig invDP mpos disss ^? _Just . nonInf
|
||||
case w ^? hud . subInventory . ciSelection of
|
||||
Just _ | i == 0 -> return $ OverCombFiltInv selpos
|
||||
Just _ -> Nothing
|
||||
@@ -436,7 +437,7 @@ updateMouseContextGame cfig u = \case
|
||||
sss <- w ^? hud . subInventory . ciSections
|
||||
Sel xl xr _ <- w ^? hud . subInventory . ciSelection . _Just
|
||||
let msel = (xl, xr)
|
||||
let mpossel = inverseSelNumPos cfig secondColumnLDP (w ^. input . mousePos) sss
|
||||
let mpossel = inverseSelNumPos cfig secondColumnLDP (w ^. input . mousePos) sss ^? _Just . nonInf
|
||||
return $ case mpossel of
|
||||
Nothing -> OverCombEscape
|
||||
Just (-1, i) | (-1, i) == msel -> OverCombFilter
|
||||
|
||||
Reference in New Issue
Block a user