@@ -29,9 +29,12 @@ title: Anotated Source
2929 @a = @
3030
3131 @version = " #VERSION#"
32- @get = new @get @
33- @remove = new @remove @
34- @create = new @create @
32+ # give access to default conf
33+ @get = new @Get @
34+ @remove = new @Remove @
35+ @create = new @Create @
36+ @set = new @Set @
37+
3538 @drawing =
3639 DrawEdge : DrawEdge @
3740 DrawEdges : DrawEdges @
@@ -63,10 +66,12 @@ title: Anotated Source
6366 " layout" : " default"
6467
6568 @startGraph = @startGraph @
69+ @updateGraph = @updateGraph @
6670 @generateLayout = @generateLayout @
6771 @svgStyles = @svgStyles @
6872 @interactions = @interactions @
6973 @search = @search @
74+ @plugins = @plugins @
7075
7176 # alchemy._nodes stores a node object as the value with the unique
7277 # id specified in the GraphJSON.
@@ -91,44 +96,35 @@ title: Anotated Source
9196
9297 begin : (userConf ) ->
9398 # overide configuration with user inputs
94- @ setConf userConf
99+ conf = @ setConf userConf
95100 switch typeof @conf .dataSource
96101 when ' string' then d3 .json @a .conf .dataSource , @a .startGraph
97102 when ' object' then @a .startGraph @a .conf .dataSource
98-
103+
104+ @plugins .init ()
99105 Alchemy :: instances .push @
100106
101107 @
102108
103109 setConf : (userConf ) ->
104110 # apply base themes
105111 if userConf .theme ?
106- userConf = _ .merge _ .cloneDeep (defaults), @a .themes [" #{ userConf .theme } " ]
112+ userConf = _ .merge _ .cloneDeep (@ defaults ), @a .themes [" #{ userConf .theme } " ]
107113
108114 for key, val of userConf
109115 switch key
110116 when " clusterColors" then userConf[" clusterColours" ] = val
111117 when " backgroundColor" then userConf[" backgroundColour" ] = val
112118 when " nodeColor" then userConf[nodeColour] = val
113119
114- @a .conf = _ .merge _ .cloneDeep (defaults), userConf
120+ @a .conf = _ .merge _ .cloneDeep (@ defaults ), userConf
115121
116122 # All alchemy instances in order of creation.
117123 instances : []
118124
119- getInst : (element )->
120- # Edge or Node
121- if element .a ?
122- element .a
123-
124- # _d3 packet
125- else if element .self ?
126- element .self .a
127-
128- # SVG element
129- else
130- Alchemy :: instances [d3 .select (element).attr (" alchInst" )]
131-
125+ getInst : (svg )->
126+ instNumber = parseInt d3 .select (svg).attr (" alchInst" )
127+ Alchemy :: instances [instNumber]
132128
133129 root = exports ? this
134130 root .Alchemy = Alchemy
0 commit comments