@@ -23,10 +23,8 @@ module Reflex.Vty.Test.Monad.Host (
2323import Relude hiding (getFirst )
2424
2525import Control.Monad.Ref
26- import qualified Data.Map as Map
2726
2827import qualified Graphics.Vty as V
29- import Potato.Reflex.Vty.Widget
3028import Reflex
3129import Reflex.Host.Class
3230import Reflex.Test.Monad.Host (MonadReflexTest (.. ), ReflexTestT ,
@@ -36,13 +34,6 @@ import Reflex.Test.Monad.Host (MonadReflexTest (..), ReflexTestT,
3634import Reflex.Vty
3735
3836
39- -- for debug layout/widget stuff
40- import Control.Monad.Fix
41- import Data.Bimap (Bimap )
42- import qualified Data.Bimap as Bimap
43- import Data.Semigroup
44-
45-
4637
4738-- | reflex-vty variant of 'ReflexTestT' which packages an 'VtyEvent' into the input and 'Behavior t [V.Image]' into the output
4839-- 'uintref' and 'uout' allow user to add their own inputs and outputs
@@ -96,10 +87,10 @@ queueMouseEventInRegion :: (Reflex t, MonadSample t m, MonadRef m)
9687queueMouseEventInRegion dr mouse = do
9788 let
9889 absCoords (Region l t _ _) (x,y) = (x+ l, y+ t)
99- region <- sample . current $ dr
90+ reg <- sample . current $ dr
10091 case mouse of
101- Left (MouseDown b c mods) -> queueVtyEvent $ uncurry V. EvMouseDown (absCoords region c) b mods
102- Right (MouseUp b c) -> queueVtyEvent $ uncurry V. EvMouseUp (absCoords region c) b
92+ Left (MouseDown b c mods) -> queueVtyEvent $ uncurry V. EvMouseDown (absCoords reg c) b mods
93+ Right (MouseUp b c) -> queueVtyEvent $ uncurry V. EvMouseUp (absCoords reg c) b
10394
10495-- | queue mouse event in a 'DynRegion'
10596-- if (local) mouse coordinates are outside of the (absolute) region, returns False and does not queue any event
@@ -108,18 +99,18 @@ queueMouseEventInRegionGated :: (Reflex t, MonadSample t m, MonadRef m)
10899 -> Either MouseDown MouseUp -- ^ mouse coordinates are LOCAL to the input region
109100 -> ReflexVtyTestT t uintref uout m Bool
110101queueMouseEventInRegionGated dr mouse = do
111- region <- sample . current $ dr
102+ reg <- sample . current $ dr
112103 let
113104 absCoords (Region l t _ _) (x,y) = (x+ l, y+ t)
114105 coordinates = case mouse of
115106 Left (MouseDown _ c _) -> c
116107 Right (MouseUp _ c) -> c
117108 withinRegion (Region _ _ w h) (x,y) = not $ or [ x < 0 , y < 0 , x >= w, y >= h ]
118- if withinRegion region coordinates
109+ if withinRegion reg coordinates
119110 then do
120111 case mouse of
121- Left (MouseDown b c mods) -> queueVtyEvent $ uncurry V. EvMouseDown (absCoords region c) b mods
122- Right (MouseUp b c) -> queueVtyEvent $ uncurry V. EvMouseUp (absCoords region c) b
112+ Left (MouseDown b c mods) -> queueVtyEvent $ uncurry V. EvMouseDown (absCoords reg c) b mods
113+ Right (MouseUp b c) -> queueVtyEvent $ uncurry V. EvMouseUp (absCoords reg c) b
123114 return True
124115 else return False
125116
0 commit comments