From cd3efa9124dac586e76adeffef9904a83d3e5186 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 25 Nov 2024 11:19:51 +0000 Subject: [PATCH] Make dragging behaviour consistent when dragging up and down This causes a slight gap when dragging backwards and forwards over large items --- ghcidOutput | 5 ----- src/Dodge/Update/Input/InGame.hs | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 5c2a9729f..4dde227a7 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -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’ | diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 82b0b4e50..981a6f26e 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -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