summaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | src/roster-editor/src/View/Character.elm | 8 | ||||
-rw-r--r-- | src/shared/elm/Util/Array.elm | 18 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm index dd5649a..c55265d 100644 --- a/src/roster-editor/src/View/Character.elm +++ b/src/roster-editor/src/View/Character.elm @@ -7,6 +7,7 @@ module View.Character exposing -- Elm ------------------------------------------------------------------------- import Html import Html.Attributes +import Html.Events -- Roster Editor --------------------------------------------------------------- import Util.Html @@ -111,7 +112,12 @@ get_portrait_html char = (Html.div [ (Html.Attributes.class "character-portrait"), - (Html.Attributes.class "character-portrait-team-0") + (Html.Attributes.class "character-portrait-team-0"), + (Html.Events.onClick + (Struct.Event.ToggleCharacterBattleIndex + (Struct.Character.get_index char) + ) + ) ] [ (get_battle_index_html char), diff --git a/src/shared/elm/Util/Array.elm b/src/shared/elm/Util/Array.elm index 362c924..26d13f6 100644 --- a/src/shared/elm/Util/Array.elm +++ b/src/shared/elm/Util/Array.elm @@ -6,6 +6,7 @@ module Util.Array exposing indexed_search ) +import List import Array update : ( @@ -36,5 +37,18 @@ filter_first fun array = indexed_search : (t -> Bool) -> (Array.Array t) -> (Maybe (Int, t)) indexed_search fun array = - -- TODO - Nothing + (List.foldl + (\v res -> + ( + case res of + (Just e) -> res + Nothing -> + let (index, value) = v in + if (fun value) + then (Just v) + else Nothing + ) + ) + Nothing + (Array.toIndexedList array) + ) |