Fix bug when dragging items

This commit is contained in:
2024-11-25 21:42:00 +00:00
parent 3ec6be2830
commit 445ca84358
2 changed files with 61 additions and 56 deletions
+7 -3
View File
@@ -258,15 +258,19 @@ shiftInvItems k x ab bn xs ss w = setSelWhileDragging . fromMaybe w $ do
guard $ xk == k || xk + 1 == k || xk -1 == k
(maxi,_) <- IS.maxView xs
(mini,_) <- IS.minView xs
if x < (k,mini)
then do
case True of
_ | x < (k,mini) -> do
guard $ not . null . fst $ IM.split mini ss
guard $ Just (k,mini-1) /= ab
return $ shiftInvItemsUp k xs w
else do
_ | x > (k,maxi) -> do
guard $ not . null . snd $ IM.split maxi ss
guard $ Just (k,maxi+1) /= bn
return $ shiftInvItemsDown k xs w
_ -> Nothing
-- if x < (k,mini)
-- then
-- else
setSelWhileDragging :: World -> World
setSelWhileDragging w = fromMaybe w $ do