mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-10-27 01:27:24 +03:00
Mouse demo: improve click message slightly
This commit is contained in:
parent
e2a1f32fb0
commit
c5ee667f72
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user