-
Notifications
You must be signed in to change notification settings - Fork 0
/
MapModel.elm
54 lines (46 loc) · 1.03 KB
/
MapModel.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module MapModel exposing (..)
import MapMsg exposing (..)
import MapNode exposing (..)
import Connectors
type ConnectorState =
Waiting
| FirstSelected
| SecondSelected
type ActionState =
Idle
| ConnectingNodes ConnectorState
| CreatingNode
| InspectingNode MapNode
type DragState =
DragNothing
| Node MapNode
| MapPan
type alias SvgPanData = {
svgPos : {x:Int,y:Int}
,panStart : {x:Int,y:Int}
}
type alias Model = {
nodes : List MapNode
,connectorData : Connectors.UIPanelData
,nodeData : MapNode.UIPanelData
,nodeCounter : Int
,dragState : DragState
,actionState : ActionState
,toolbarText : String
,svgScale : Float
,nodeSize : Int
,panData : SvgPanData
}
init : ( Model, Cmd Msg )
init = ({
nodes = []
,connectorData = Connectors.getPanelInit 0
,nodeData = MapNode.getPanelInit 0
,nodeCounter = 0
,dragState = DragNothing
,actionState = Idle
,toolbarText = ""
,svgScale = 1.0
,nodeSize = 100
,panData = { svgPos = {x=0,y=0}, panStart = {x=0,y=0}}
}, Cmd.none)