Mouse demo: improve click message slightly

This commit is contained in:
Jonathan Daugherty 2022-05-12 08:14:27 -07:00
parent e2a1f32fb0
commit c5ee667f72

View File

@ -77,11 +77,13 @@ infoLayer st = T.Widget T.Fixed T.Fixed $ do
c <- T.getContext
let h = c^.T.availHeightL
msg = case st^.lastReportedClick of
Nothing -> "nothing"
Just (name, T.Location l) -> show name <> " at " <> show l
Nothing ->
"Click and hold/drag to report a mouse click"
Just (name, T.Location l) ->
"Mouse down at " <> show name <> " @ " <> show l
T.render $ translateBy (T.Location (0, h-1)) $ clickable Info $
withDefAttr "info" $
C.hCenter (str ("Last reported click: " <> msg))
C.hCenter $ str msg
appEvent :: St -> T.BrickEvent Name e -> T.EventM Name (T.Next St)
appEvent st (T.MouseDown n _ _ loc) = do