Fix terminal mouse over positioning

This commit is contained in:
2025-12-24 20:10:03 +00:00
parent 3cdab08184
commit de6bbe7697
5 changed files with 132 additions and 120 deletions
+10 -12
View File
@@ -3,6 +3,7 @@
module Dodge.Update (updateUniverse) where
import Dodge.Render.List
import Data.Foldable
import qualified Data.Set as S
import Color
@@ -399,19 +400,16 @@ getMenuMouseContext screen u = case screen ^. scOptions of
return $ if t then MouseMenuClick yi else NoMouseContext
isOverTerminalScreen :: Config -> Point2 -> Bool
isOverTerminalScreen cfig (V2 x y) =
x <= xmax
&& x >= xmin - 5
&& y <= ymax + 5
&& y >= ymin
isOverTerminalScreen cfig (V2 x y) = fromMaybe False $ do
(V2 xmin ymax, V2 xmax ymin) <- ldpRect cfig terminalLDP
return $ x <= xmax && x >= xmin && y <= ymax && y >= ymin
where
--ldp = secondColumnLDP
ldp = invDP
V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
tsize = fromIntegral $ getMaxLinesTM + 1
s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
ymin = ymax - s
xmax = xmin + 555 -- HACK drawSelectionListBackground
-- ldp = terminalLDP
-- V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
-- tsize = fromIntegral $ getMaxLinesTM + 1
-- s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
-- ymin = ymax - s
-- xmax = xmin + 555 -- HACK drawSelectionListBackground
updateWheelEvents :: World -> World
updateWheelEvents w = case w ^. input . scrollAmount of