Simplify update case statement

This commit is contained in:
Emi Simpson 2023-06-28 23:30:26 -04:00
parent bf9be21291
commit b258ffbeb9
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 7 additions and 7 deletions

View File

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