summaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | src/map-editor/src/ElmModule/View.elm | 5 | ||||
-rw-r--r-- | src/map-editor/src/Struct/Map.elm | 4 | ||||
-rw-r--r-- | src/map-editor/src/View/Toolbox.elm | 36 |
3 files changed, 30 insertions, 15 deletions
diff --git a/src/map-editor/src/ElmModule/View.elm b/src/map-editor/src/ElmModule/View.elm index 40ec9b0..5c85fc0 100644 --- a/src/map-editor/src/ElmModule/View.elm +++ b/src/map-editor/src/ElmModule/View.elm @@ -32,10 +32,7 @@ view model = ] [ (View.MainMenu.get_html), - (Html.Lazy.lazy - (View.Toolbox.get_html) - model.toolbox - ), + (View.Toolbox.get_html model), (Html.div [ (Html.Attributes.class "map-container-centerer") diff --git a/src/map-editor/src/Struct/Map.elm b/src/map-editor/src/Struct/Map.elm index 5c2e24b..c175de0 100644 --- a/src/map-editor/src/Struct/Map.elm +++ b/src/map-editor/src/Struct/Map.elm @@ -5,6 +5,7 @@ module Struct.Map exposing new, get_width, get_height, + get_markers, get_tiles, set_tile_to, solve_tiles, @@ -64,6 +65,9 @@ get_height map = map.height get_tiles : Type -> (Array.Array Struct.TileInstance.Type) get_tiles map = map.content +get_markers : Type -> (Dict.Dict String Struct.MapMarker.Type) +get_markers map = map.markers + set_tile_to : Struct.Location.Type -> Struct.TileInstance.Type -> Type -> Type set_tile_to loc tile_inst map = {map | diff --git a/src/map-editor/src/View/Toolbox.elm b/src/map-editor/src/View/Toolbox.elm index 28e7ba6..9d934e1 100644 --- a/src/map-editor/src/View/Toolbox.elm +++ b/src/map-editor/src/View/Toolbox.elm @@ -1,12 +1,16 @@ module View.Toolbox exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Dict + import Html import Html.Attributes import Html.Events -- Map Editor ------------------------------------------------------------------ import Struct.Event +import Struct.Map +import Struct.Model import Struct.Tile import Struct.TileInstance import Struct.Toolbox @@ -113,17 +117,27 @@ get_others_menu_html = ] ) --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : Struct.Toolbox.Type -> (Html.Html Struct.Event.Type) -get_html tb = - (Html.div - [(Html.Attributes.class "toolbox")] +get_markers_html : (List String) -> (Html.Html Struct.Event.Type) +get_markers_html markers_name = + (Html.select [ - (get_template_icon_html (Struct.Toolbox.get_template tb)), - (get_modes_menu_html tb), - (get_shapes_menu_html tb), - (get_others_menu_html) ] + (List.map (Html.text) markers_name) ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + let tb = model.toolbox in + (Html.div + [(Html.Attributes.class "toolbox")] + [ + (get_template_icon_html (Struct.Toolbox.get_template tb)), + (get_modes_menu_html tb), + (get_shapes_menu_html tb), + (get_markers_html (Dict.keys (Struct.Map.get_markers model.map))), + (get_others_menu_html) + ] + ) |