Improve drag inventory selection
This commit is contained in:
@@ -190,16 +190,24 @@ inverseSelSecYint yint sss
|
||||
return $ NonInf (i, j)
|
||||
|
||||
inverseSelSecYintXPosCheck ::
|
||||
Config -> LDParams -> Float -> Int -> IMSS a -> Maybe (Int, Int)
|
||||
Config -> LDParams -> Float -> Int -> IMSS a -> Maybe (XInfinity (Int, Int))
|
||||
inverseSelSecYintXPosCheck cfig ldp x yint sss = do
|
||||
(i, j) <- inverseSelSecYint yint sss ^? nonInf
|
||||
let sel = inverseSelSecYint yint sss
|
||||
(i,j) <- case sel of
|
||||
NonInf v -> Just v
|
||||
NegInf -> do
|
||||
(i',j',_) <- ssLookupMin sss
|
||||
return (i',j')
|
||||
PosInf -> do
|
||||
(i',j',_) <- ssLookupMax sss
|
||||
return (i',j')
|
||||
let V2 x0 _ = screenPosAbs cfig (ldp ^. ldpPos)
|
||||
sindent <- sss ^? ix i . ssIndent
|
||||
itindent <- sss ^? ix i . ssItems . ix j . siOffX
|
||||
let x1 = x0 + _ldpScale ldp * 10 * (fromIntegral (sindent + itindent) - 0.5)
|
||||
guard $ x - x1 < 160 && x > x1
|
||||
return (i, j)
|
||||
return sel
|
||||
|
||||
inverseSelNumPos :: Config -> LDParams -> Point2 -> IMSS a -> Maybe (Int, Int)
|
||||
inverseSelNumPos :: Config -> LDParams -> Point2 -> IMSS a -> Maybe (XInfinity (Int, Int))
|
||||
inverseSelNumPos cfig ldp (V2 x y) =
|
||||
inverseSelSecYintXPosCheck cfig ldp x (posSelSecYint cfig ldp y)
|
||||
|
||||
Reference in New Issue
Block a user