From 2613aeeae0f4de44842ff0e796603d0316a61a14 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Wed, 18 Mar 2015 00:32:17 +0100 Subject: Can edit the time, unfortunately the enter key is overriden so the '+' key of the numpad is used instead --- src/Update/UpdateTimer.elm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/Update/UpdateTimer.elm') diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm index 3eba549..e4671d9 100644 --- a/src/Update/UpdateTimer.elm +++ b/src/Update/UpdateTimer.elm @@ -3,26 +3,40 @@ module Update.UpdateTimer , updateTimer ) where +import Time (Time) + import Model.Timer (..) import Model.Id (..) type TimerAction = Restart + | Pause | ToggleRunning | Stop + | SetTime Time updateTimer : TimerAction -> Timer -> Timer updateTimer action timer = case action of - ToggleRunning -> - { timer | isRunning <- timer.currentTime > 0.0 && not timer.isRunning } Restart -> { timer | isRunning <- True , currentTime <- initTime timer.initialTime } + Pause -> + { timer + | isRunning <- False + } + ToggleRunning -> + { timer | isRunning <- timer.currentTime > 0.0 && not timer.isRunning } Stop -> { timer | isRunning <- False , currentTime <- initTime timer.initialTime } + SetTime time -> + let augmentedTime = time + 999 + in { timer + | initialTime <- augmentedTime + , currentTime <- augmentedTime + } -- cgit v1.2.3