Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Add click events for the different polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
viktornonov committed Jul 9, 2016
1 parent b3aa37f commit a19386b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Joystick.elm
Expand Up @@ -8,10 +8,11 @@ module Joystick

import Html exposing (Html, div, button)
import Html.App as Html
import Html.Events exposing (onClick)
-- import Html.Events exposing (onClick)
import Debug exposing (log)
import Svg exposing (..)
import Svg.Attributes exposing (..)
import Svg.Events exposing (onClick)
import Color exposing (..)


Expand All @@ -32,6 +33,7 @@ model =
{ position = None }



-- UPDATE


Expand All @@ -54,15 +56,15 @@ update msg model =
}



-- VIEW


view : Model -> Html Msg
view model =
div []
[ svg
[ onClick Left
, version "1.1"
[ version "1.1"
, x "0"
, y "0"
, viewBox "0 0 100 100"
Expand All @@ -72,34 +74,39 @@ view model =
, points "0 0, 30 30, 30 70, 0 100"
, stroke "indianred"
, strokeWidth (toString edgeRatio)
, onClick Left
]
[]
, polygon
[ fill "white"
, points "0 0, 30 30, 70 30, 100 0"
, stroke "indianred"
, strokeWidth (toString edgeRatio)
, onClick Up
]
[]
, polygon
[ fill "white"
, points "100 0, 70 30, 70 70, 100 100"
, stroke "indianred"
, strokeWidth (toString edgeRatio)
, onClick Right
]
[]
, polygon
[ fill "white"
, points "0 100, 30 70, 70 70, 100 100"
, stroke "indianred"
, strokeWidth (toString edgeRatio)
, onClick Down
]
[]
, polygon
[ fill "red"
, points "30 30, 70 30, 70 70, 30 70"
, stroke "indianred"
, strokeWidth (toString edgeRatio)
-- , onClick Left
]
[]
]
Expand Down

0 comments on commit a19386b

Please sign in to comment.