From 00d8190ffc0cf6d36b640d4ee4dd99a38d3cd1f9 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 25 Nov 2024 20:41:30 +0000 Subject: [PATCH] Fix bug not allowing dragging at extreme bottom edge --- ghcidOutput | 2 +- src/Dodge/TestString.hs | 16 ++++++++++++++++ src/Dodge/Update/Input/InGame.hs | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index d98a64403..61f0a400d 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 20:03:59) +All good (594 modules, at 20:39:56) diff --git a/src/Dodge/TestString.hs b/src/Dodge/TestString.hs index c7a5de202..8a15cfc14 100644 --- a/src/Dodge/TestString.hs +++ b/src/Dodge/TestString.hs @@ -1,6 +1,9 @@ {-# OPTIONS_GHC -Wno-unused-imports #-} module Dodge.TestString where +import Linear +import Dodge.ListDisplayParams +import Dodge.SelectionSections import qualified Control.Foldl as L import Dodge.DoubleTree import Dodge.Data.DoubleTree @@ -24,7 +27,20 @@ testStringInit :: Universe -> [String] testStringInit u = [ show $ u ^? uvWorld . input . mouseContext . mcoSelEnd , show $ u ^? uvWorld . hud . hudElement . diSelection + , show $ u ^? uvWorld . input . mouseContext + , show $ u ^? uvWorld . input . mouseContext . mcoDragSection + , show $ u ^? uvWorld . input . mouseContext . mcoMaybeSelect + , show $ u ^? uvWorld . input . mouseContext . mcoAboveSelect + , show $ u ^? uvWorld . input . mouseContext . mcoBelowSelect + , show mpos + , show yint + , show $ u ^? uvWorld . hud . hudElement . diSections >>= inverseSelSecYint yint ] + where + idp = invDisplayParams $ u ^. uvWorld + cfig = u ^. uvConfig + yint = posSelSecYint cfig idp y + mpos@(V2 _ y) = u ^. uvWorld . input . mousePos -- , show . fmap (fmap _siPictures) $ u ^? uvWorld . hud . hudElement . diSections . ix (-1) . ssItems -- <> [[toEnum (i+j * 32) | i <- [0..31]] | j <- [0..7]] -- <> map show (IM.elems (L.postscan (L.premap _siHeight L.sum) diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 3bef44906..1aa3e50c8 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -292,7 +292,7 @@ shiftInvItems k x ab bn xs ss w = setSelWhileDragging . fromMaybe w $ do return $ shiftInvItemsUp k xs w else do guard $ not . null . snd $ IM.split maxi ss - guard $ Just (k,maxi+1) < bn + guard $ Just (k,maxi+1) /= bn return $ shiftInvItemsDown k xs w setSelWhileDragging :: World -> World