fabiommendes / elm-svg-editor / Svg.Editor

Basic types


type alias Config =
Config

Editor config


type Model

Editor model


type alias Msg =
Msg

Message

Type alias


type alias Meters =
Basics.Float

Length units


type alias Url =
String

Type alias for Urls


type alias Text =
String

Type alias for textual data. Usually strings that are shown directly to the end user.

Elm Archtecture

defaulConfig : Config

Configuration object

init : Config -> Model

Init function in TEA

subscriptions : Config -> Model -> Platform.Sub.Sub Msg

Subscription function in TEA

update : Config -> Msg -> Model -> ( Model, Platform.Cmd.Cmd Msg )

Update function in TEA

view : Config -> Model -> Html Msg

View function in TEA

cmd : Platform.Cmd.Cmd Msg

Command to properly initialize the editor

Inserting elements to the scene

withFigures : String -> List Figure -> Model -> Model

Add list of figures to model

image : Meters -> Url -> Figure

Create an image with given width and source URL

line : List ( Meters, Meters ) -> Figure

Create a line from a list of vertices

point : ( Meters, Meters ) -> Figure

Create a point at origin.

Use move to set its position.

text : Text -> Figure

Create a text figure from string

Figure transformations

editable : Basics.Bool -> Figure -> Figure

Control if figure is editable or not

grow : Basics.Float -> Figure -> Figure

Re-scale figure by the given scaling factor

move : ( Meters, Meters ) -> Figure -> Figure

Move figure by the given vector displacement

visible : Basics.Bool -> Figure -> Figure

Control if figure is visible or not

withLabel : Types.Label -> Figure -> Figure

Set figure label

withStyle : String -> String -> Figure -> Figure

Add style to figure

Persistence

load : String -> Model -> Model

Load scene from json data

save : Model -> String

Save scene to json

select : Types.Key -> Model -> Model

Select element with the given key.

Invalid keys clear the current selection

selectSubKey : Types.SubKey -> Model -> Model

Select sub-key of the current element