GUI -- Cleaned up initialization of SVG definitions.
Change-Id: I48379121f7e9c99f37f95e0620de06a20d3ff3d2
diff --git a/web/gui/src/main/webapp/d3Utils.js b/web/gui/src/main/webapp/d3Utils.js
index 6620f7d..42e371c 100644
--- a/web/gui/src/main/webapp/d3Utils.js
+++ b/web/gui/src/main/webapp/d3Utils.js
@@ -120,10 +120,10 @@
return drag;
}
- function appendGlow(svg) {
+ function loadGlow(defs) {
// TODO: parameterize color
- var glow = svg.append('filter')
+ var glow = defs.append('filter')
.attr('x', '-50%')
.attr('y', '-50%')
.attr('width', '200%')
@@ -132,10 +132,11 @@
glow.append('feColorMatrix')
.attr('type', 'matrix')
- .attr('values', '0 0 0 0 0 ' +
- '0 0 0 0 0 ' +
- '0 0 0 0 .7 ' +
- '0 0 0 1 0 ');
+ .attr('values',
+ '0 0 0 0 0 ' +
+ '0 0 0 0 0 ' +
+ '0 0 0 0 .7 ' +
+ '0 0 0 1 0 ');
glow.append('feGaussianBlur')
.attr('stdDeviation', 3)
@@ -242,7 +243,7 @@
// === register the functions as a library
onos.ui.addLib('d3util', {
createDragBehavior: createDragBehavior,
- appendGlow: appendGlow,
+ loadGlow: loadGlow,
cat7: cat7
});
diff --git a/web/gui/src/main/webapp/glyphs.js b/web/gui/src/main/webapp/glyphs.js
index a5fad90..cb74167 100644
--- a/web/gui/src/main/webapp/glyphs.js
+++ b/web/gui/src/main/webapp/glyphs.js
@@ -107,10 +107,14 @@
});
}
+ function loadDefs(defs) {
+ defStuff(defs, birdViewBox, birdData);
+ defStuff(defs, glyphViewBox, glyphData);
+ defStuff(defs, badgeViewBox, badgeData);
+ }
+
onos.ui.addLib('glyphs', {
- defBird: function (defs) { defStuff(defs, birdViewBox, birdData); },
- defGlyphs: function (defs) { defStuff(defs, glyphViewBox, glyphData); },
- defBadges: function (defs) { defStuff(defs, badgeViewBox, badgeData); }
+ loadDefs: loadDefs
});
}(ONOS));
diff --git a/web/gui/src/main/webapp/topo.js b/web/gui/src/main/webapp/topo.js
index ce1fceb..f52b0c9 100644
--- a/web/gui/src/main/webapp/topo.js
+++ b/web/gui/src/main/webapp/topo.js
@@ -2831,11 +2831,10 @@
}
- function loadGlyphs(svg) {
+ function setupDefs(svg) {
var defs = svg.append('defs');
- gly.defBird(defs);
- gly.defGlyphs(defs);
- gly.defBadges(defs);
+ gly.loadDefs(defs);
+ d3u.loadGlow(defs);
}
function sendUpdateMeta(d, store) {
@@ -2872,9 +2871,8 @@
svg = view.$div.append('svg').attr('viewBox', viewBox);
setSize(svg, view);
- // load glyphs and filters...
- loadGlyphs(svg);
- d3u.appendGlow(svg);
+ // load glyphs, filters, and other definitions...
+ setupDefs(svg);
panZoomContainer = svg.append('g').attr('id', 'panZoomContainer');
setupPanZoom();