mirror of
https://github.com/jtdaugherty/brick.git
synced 2025-01-06 05:14:11 +03:00
Layer demo: improve layout of event handler to make layer handling distinction clearer
This commit is contained in:
parent
32c82d0754
commit
e9c587189d
@ -36,14 +36,16 @@ bottomLayer st =
|
||||
border "Bottom layer\n(Ctrl-arrow keys move)"
|
||||
|
||||
appEvent :: St -> Event -> EventM (Next St)
|
||||
appEvent st (EvKey KDown []) = continue $ st & topLayerLocation.row %~ (+ 1)
|
||||
appEvent st (EvKey KUp []) = continue $ st & topLayerLocation.row %~ (subtract 1)
|
||||
appEvent st (EvKey KDown []) = continue $ st & topLayerLocation.row %~ (+ 1)
|
||||
appEvent st (EvKey KUp []) = continue $ st & topLayerLocation.row %~ (subtract 1)
|
||||
appEvent st (EvKey KRight []) = continue $ st & topLayerLocation.column %~ (+ 1)
|
||||
appEvent st (EvKey KLeft []) = continue $ st & topLayerLocation.column %~ (subtract 1)
|
||||
appEvent st (EvKey KDown [MCtrl]) = continue $ st & bottomLayerLocation.row %~ (+ 1)
|
||||
appEvent st (EvKey KUp [MCtrl]) = continue $ st & bottomLayerLocation.row %~ (subtract 1)
|
||||
appEvent st (EvKey KLeft []) = continue $ st & topLayerLocation.column %~ (subtract 1)
|
||||
|
||||
appEvent st (EvKey KDown [MCtrl]) = continue $ st & bottomLayerLocation.row %~ (+ 1)
|
||||
appEvent st (EvKey KUp [MCtrl]) = continue $ st & bottomLayerLocation.row %~ (subtract 1)
|
||||
appEvent st (EvKey KRight [MCtrl]) = continue $ st & bottomLayerLocation.column %~ (+ 1)
|
||||
appEvent st (EvKey KLeft [MCtrl]) = continue $ st & bottomLayerLocation.column %~ (subtract 1)
|
||||
appEvent st (EvKey KLeft [MCtrl]) = continue $ st & bottomLayerLocation.column %~ (subtract 1)
|
||||
|
||||
appEvent st (EvKey KEsc []) = halt st
|
||||
appEvent st _ = continue st
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user