Simon Hunt
Committed by Gerrit Code Review

GUI -- Cleaned up initialization of SVG definitions.

Change-Id: I48379121f7e9c99f37f95e0620de06a20d3ff3d2
...@@ -120,10 +120,10 @@ ...@@ -120,10 +120,10 @@
120 return drag; 120 return drag;
121 } 121 }
122 122
123 - function appendGlow(svg) { 123 + function loadGlow(defs) {
124 // TODO: parameterize color 124 // TODO: parameterize color
125 125
126 - var glow = svg.append('filter') 126 + var glow = defs.append('filter')
127 .attr('x', '-50%') 127 .attr('x', '-50%')
128 .attr('y', '-50%') 128 .attr('y', '-50%')
129 .attr('width', '200%') 129 .attr('width', '200%')
...@@ -132,10 +132,11 @@ ...@@ -132,10 +132,11 @@
132 132
133 glow.append('feColorMatrix') 133 glow.append('feColorMatrix')
134 .attr('type', 'matrix') 134 .attr('type', 'matrix')
135 - .attr('values', '0 0 0 0 0 ' + 135 + .attr('values',
136 - '0 0 0 0 0 ' + 136 + '0 0 0 0 0 ' +
137 - '0 0 0 0 .7 ' + 137 + '0 0 0 0 0 ' +
138 - '0 0 0 1 0 '); 138 + '0 0 0 0 .7 ' +
139 + '0 0 0 1 0 ');
139 140
140 glow.append('feGaussianBlur') 141 glow.append('feGaussianBlur')
141 .attr('stdDeviation', 3) 142 .attr('stdDeviation', 3)
...@@ -242,7 +243,7 @@ ...@@ -242,7 +243,7 @@
242 // === register the functions as a library 243 // === register the functions as a library
243 onos.ui.addLib('d3util', { 244 onos.ui.addLib('d3util', {
244 createDragBehavior: createDragBehavior, 245 createDragBehavior: createDragBehavior,
245 - appendGlow: appendGlow, 246 + loadGlow: loadGlow,
246 cat7: cat7 247 cat7: cat7
247 }); 248 });
248 249
......
...@@ -107,10 +107,14 @@ ...@@ -107,10 +107,14 @@
107 }); 107 });
108 } 108 }
109 109
110 + function loadDefs(defs) {
111 + defStuff(defs, birdViewBox, birdData);
112 + defStuff(defs, glyphViewBox, glyphData);
113 + defStuff(defs, badgeViewBox, badgeData);
114 + }
115 +
110 onos.ui.addLib('glyphs', { 116 onos.ui.addLib('glyphs', {
111 - defBird: function (defs) { defStuff(defs, birdViewBox, birdData); }, 117 + loadDefs: loadDefs
112 - defGlyphs: function (defs) { defStuff(defs, glyphViewBox, glyphData); },
113 - defBadges: function (defs) { defStuff(defs, badgeViewBox, badgeData); }
114 }); 118 });
115 119
116 }(ONOS)); 120 }(ONOS));
......
...@@ -2831,11 +2831,10 @@ ...@@ -2831,11 +2831,10 @@
2831 2831
2832 } 2832 }
2833 2833
2834 - function loadGlyphs(svg) { 2834 + function setupDefs(svg) {
2835 var defs = svg.append('defs'); 2835 var defs = svg.append('defs');
2836 - gly.defBird(defs); 2836 + gly.loadDefs(defs);
2837 - gly.defGlyphs(defs); 2837 + d3u.loadGlow(defs);
2838 - gly.defBadges(defs);
2839 } 2838 }
2840 2839
2841 function sendUpdateMeta(d, store) { 2840 function sendUpdateMeta(d, store) {
...@@ -2872,9 +2871,8 @@ ...@@ -2872,9 +2871,8 @@
2872 svg = view.$div.append('svg').attr('viewBox', viewBox); 2871 svg = view.$div.append('svg').attr('viewBox', viewBox);
2873 setSize(svg, view); 2872 setSize(svg, view);
2874 2873
2875 - // load glyphs and filters... 2874 + // load glyphs, filters, and other definitions...
2876 - loadGlyphs(svg); 2875 + setupDefs(svg);
2877 - d3u.appendGlow(svg);
2878 2876
2879 panZoomContainer = svg.append('g').attr('id', 'panZoomContainer'); 2877 panZoomContainer = svg.append('g').attr('id', 'panZoomContainer');
2880 setupPanZoom(); 2878 setupPanZoom();
......