mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-02 01:01:03 +01:00
Added 'B' keystroke to toggle background image visibility.
Also added configuration boolean to indicate whether the background image should be visible on startup.
This commit is contained in:
parent
76285c7712
commit
ee66e61638
@ -36,8 +36,10 @@
|
||||
},
|
||||
options: {
|
||||
layering: true,
|
||||
collisionPrevention: true
|
||||
collisionPrevention: true,
|
||||
loadBackground: true
|
||||
},
|
||||
backgroundUrl: 'img/us-map.png',
|
||||
data: {
|
||||
live: {
|
||||
jsonUrl: 'rs/topology/graph',
|
||||
@ -265,6 +267,9 @@
|
||||
function processKeyEvent() {
|
||||
var code = d3.event.keyCode;
|
||||
switch (code) {
|
||||
case 66: // B
|
||||
toggleBackground();
|
||||
break;
|
||||
case 71: // G
|
||||
cycleLayout();
|
||||
break;
|
||||
@ -281,6 +286,13 @@
|
||||
|
||||
}
|
||||
|
||||
function toggleBackground() {
|
||||
var bg = d3.select('#bg'),
|
||||
vis = bg.style('visibility'),
|
||||
newvis = (vis === 'hidden') ? 'visible' : 'hidden';
|
||||
bg.style('visibility', newvis);
|
||||
}
|
||||
|
||||
function cycleLayout() {
|
||||
config.options.layering = !config.options.layering;
|
||||
network.force.resume();
|
||||
@ -437,8 +449,10 @@
|
||||
id: 'bg',
|
||||
width: view.width,
|
||||
height: view.height,
|
||||
'xlink:href': 'img/us-map.png'
|
||||
});
|
||||
'xlink:href': config.backgroundUrl
|
||||
})
|
||||
.style('visibility',
|
||||
config.options.loadBackground ? 'visible' : 'hidden');
|
||||
|
||||
// function zoomRedraw() {
|
||||
// d3.select("#zoomable").attr("transform",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user