Simon Hunt
Committed by Gerrit Code Review

GUI -- Cleaned up initialization of SVG definitions.

Change-Id: I48379121f7e9c99f37f95e0620de06a20d3ff3d2
......@@ -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
});
......
......@@ -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));
......
......@@ -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();
......