diff options
author | Joris Guyonvarch | 2015-03-21 15:57:37 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-21 15:57:37 +0100 |
commit | d57ea4eda1339ae55f1f1f6341d1af6b1a690330 (patch) | |
tree | 668fae3e2f10c6915eeb90309f789a63a900b04e /src/Update/Update.elm | |
parent | c73c712a56213b327b9d53262b81c80a3e23dcae (diff) |
Can remove numbers in timer edition
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r-- | src/Update/Update.elm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Update/Update.elm b/src/Update/Update.elm index 5e8c13e..76f3f1d 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -98,8 +98,15 @@ update action model = ReadOnly -> { model | timerEdition <- Nothing } KeyPressed keyCode -> - { model | timerEdition <- Maybe.map (updateTimerEdition (keyCodeToNumberChar keyCode)) model.timerEdition } + if isRemoveKeyCode keyCode + then + { model | timerEdition <- Maybe.map (updateTimerEdition DeleteLast) model.timerEdition } + else + { model | timerEdition <- Maybe.map (updateTimerEdition (AddNumber keyCode)) model.timerEdition } updateTimerTime : TimerEdition -> Dict Id Timer -> Dict Id Timer updateTimerTime timerEdition = Dict.update timerEdition.id (Maybe.map (updateTimer (SetTime (toTime timerEdition.numbers)))) + +isRemoveKeyCode : KeyCode -> Bool +isRemoveKeyCode = (==) 8 |