Layer demo: improve layout of event handler to make layer handling distinction clearer

This commit is contained in:
Jonathan Daugherty 2015-07-03 16:04:23 -07:00
parent 32c82d0754
commit e9c587189d

View File

@ -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