fabiommendes/elm-svg-editor/2.1.0

Svg.Editor

Basic types

type alias Config =
Config

Editor config

type Model

Editor model

type alias Msg =
Msg

Message

Type alias

type alias Meters =
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 -> Sub Msg

Subscription function in TEA

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

Update function in TEA

view : Config -> Model -> Html Msg

View function in TEA

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 : Bool -> Figure -> Figure

Control if figure is editable or not

grow : Float -> Figure -> Figure

Re-scale figure by the given scaling factor

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

Move figure by the given vector displacement

visible : Bool -> Figure -> Figure

Control if figure is visible or not

withLabel : 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 : Key -> Model -> Model

Select element with the given key.

Invalid keys clear the current selection

selectSubKey : SubKey -> Model -> Model

Select sub-key of the current element