...
 
Commits (1)
......@@ -76,6 +76,7 @@ type Msg
| Back
| Enter
| SetDecimal
| SetSign
update : Msg -> Model -> Model
......@@ -88,6 +89,16 @@ update msg model =
else
{ model | currentNum = model.currentNum ++ "." }
SetSign ->
if model.currentNum == "0" then
model
else if String.startsWith "-" model.currentNum then
{ model | currentNum = String.dropLeft 1 model.currentNum }
else
{ model | currentNum = "-" ++ model.currentNum }
ClearAll ->
initialModel
......@@ -229,7 +240,8 @@ section =
, cell (onClick <| InputOperator Add) Single Yellow "+"
, cell (onClick <| InputNumber 0) Single White "0"
, cell (onClick SetDecimal) Single White "."
, cell (onClick <| Enter) Double Yellow "Enter"
, cell (onClick SetSign) Single White "+/-"
, cell (onClick <| Enter) Single Yellow "Enter"
]
......