Make dragging behaviour consistent when dragging up and down

This causes a slight gap when dragging backwards and forwards over
large items
This commit is contained in:
2024-11-25 11:19:51 +00:00
parent 2c6037d852
commit cd3efa9124
2 changed files with 5 additions and 10 deletions
-5
View File
@@ -1,8 +1,3 @@
/home/justin/Haskell/loop/src/Dodge/Update/Input/InGame.hs:247:22-23: warning: [-Wunused-matches]
Defined but not used: bn
|
247 | shiftInvItems k x ab bn xs ss w = fromMaybe w $ do
| ^^
/home/justin/Haskell/loop/src/Dodge/Update/Input/InGame.hs:252:13-17: warning: [-Wunused-matches]
Defined but not used: above
|
+5 -5
View File
@@ -251,13 +251,13 @@ shiftInvItems k x ab bn xs ss w = fromMaybe w $ do
then do
above <- ss ^? ix (mini - 1)
guard $ Just (k,mini-1) /= ab
-- minss <- IM.lookupMin ss
-- guard (mini > fst minss)
return $ shiftInvItemsUp k xs w
else do
guard $ x > (k,maxi)
maxss <- IM.lookupMax ss
guard (maxi < fst maxss)
--guard $ x > (k,maxi)
--maxss <- IM.lookupMax ss
--guard (maxi < fst maxss)
_ <- ss ^? ix (maxi + 1)
guard $ Just (k,maxi+1) < bn
return $ shiftInvItemsDown k xs w
shiftInvItemsUp :: Int -> IS.IntSet -> World -> World