Simplify update case statement
This commit is contained in:
parent
bf9be21291
commit
b258ffbeb9
14
src/Main.elm
14
src/Main.elm
|
@ -183,27 +183,27 @@ modColumnInPage columnIndex f model =
|
|||
}
|
||||
|
||||
update : Msg -> Model -> (Model, Cmd Msg)
|
||||
update msg model = case Debug.log "UPDATE" (msg, model) of
|
||||
(Noop, _) -> (model, Cmd.none)
|
||||
(WindowSize w h, _) ->
|
||||
update msg model = case Debug.log "UPDATE" msg of
|
||||
Noop -> (model, Cmd.none)
|
||||
WindowSize w h ->
|
||||
{ model | windowW = w, windowH = h }
|
||||
|> withoutCmd
|
||||
(Click columnIndex tileIndex x y, _) ->
|
||||
Click columnIndex tileIndex x y ->
|
||||
(modColumnInPage columnIndex << modTileInColumn tileIndex)
|
||||
(addStickerToTile <| Sticker (TextSticker "red" "<3") "Into This" x y)
|
||||
model
|
||||
|> withoutCmd
|
||||
( SetTileText columnIndex tileIndex newText, _) ->
|
||||
SetTileText columnIndex tileIndex newText ->
|
||||
(modColumnInPage columnIndex << modTileInColumn tileIndex)
|
||||
(updateTileText newText)
|
||||
model
|
||||
|> withoutCmd
|
||||
( AddTile columnIndex, _ ) ->
|
||||
AddTile columnIndex ->
|
||||
modColumnInPage columnIndex
|
||||
addTileToColumn
|
||||
model
|
||||
|> withoutCmd
|
||||
( TileDeselected columnIndex, _ ) ->
|
||||
TileDeselected columnIndex ->
|
||||
modColumnInPage columnIndex
|
||||
pruneTiles
|
||||
model
|
||||
|
|
Loading…
Reference in New Issue