fullscreen mode for netmap
This commit is contained in:
@@ -629,6 +629,7 @@ form .clearfix.success input {
|
|||||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||||
/* D3 SVG */
|
/* D3 SVG */
|
||||||
|
|
||||||
|
/*
|
||||||
.node circle {
|
.node circle {
|
||||||
fill: #fff;
|
fill: #fff;
|
||||||
stroke: steelblue;
|
stroke: steelblue;
|
||||||
@@ -651,6 +652,7 @@ form .clearfix.success input {
|
|||||||
stroke-width: 2px;
|
stroke-width: 2px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||||
/* dataTables */
|
/* dataTables */
|
||||||
|
|||||||
@@ -1,6 +1,23 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, function(mapdata) {
|
function requestFullScreen(elt) {
|
||||||
|
// console.log("Requesting fullscreen for", elt);
|
||||||
|
if (elt.requestFullscreen) {
|
||||||
|
elt.requestFullscreen();
|
||||||
|
} else if (elt.msRequestFullscreen) {
|
||||||
|
elt.msRequestFullscreen();
|
||||||
|
} else if (elt.mozRequestFullScreen) {
|
||||||
|
elt.mozRequestFullScreen();
|
||||||
|
} else if (elt.webkitRequestFullscreen) {
|
||||||
|
elt.webkitRequestFullscreen();
|
||||||
|
} else {
|
||||||
|
// console.error("Fullscreen not available");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function() {
|
||||||
|
resizeGraphContainer();
|
||||||
|
});
|
||||||
|
|
||||||
// custom resize function as there is no event to fire and we need
|
// custom resize function as there is no event to fire and we need
|
||||||
// to react to the sidebar.
|
// to react to the sidebar.
|
||||||
@@ -12,9 +29,11 @@ $.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, fu
|
|||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, function(mapdata) {
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
window.graph = netGobrechtsD3Force('netmap_pane')
|
window.graph = netGobrechtsD3Force('netmap_pane')
|
||||||
.debug(true)
|
// .debug(true)
|
||||||
.lassoMode(true)
|
.lassoMode(true)
|
||||||
.dragMode(true)
|
.dragMode(true)
|
||||||
.nodeEventToOpenLink('click')
|
.nodeEventToOpenLink('click')
|
||||||
@@ -92,6 +111,19 @@ $.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, fu
|
|||||||
}};
|
}};
|
||||||
graph.start(netmapdata);
|
graph.start(netmapdata);
|
||||||
|
|
||||||
|
graph.inspect().dom.svg
|
||||||
|
.append("svg:text")
|
||||||
|
.attr("id", "nd2_fullscreen_netmap")
|
||||||
|
.attr("class", "link")
|
||||||
|
.attr("x", (graph.width() - 17))
|
||||||
|
.attr("y", 17)
|
||||||
|
.attr("text-anchor", "start")
|
||||||
|
.attr("font-family", "FontAwesome")
|
||||||
|
.text(function() { return '\uf0b2' })
|
||||||
|
.on("click", function() {
|
||||||
|
requestFullScreen(document.getElementById('netmap_pane'));
|
||||||
|
});
|
||||||
|
|
||||||
// center on our selected device
|
// center on our selected device
|
||||||
// graph.inspect().main.force.on('end.centernode', function() {
|
// graph.inspect().main.force.on('end.centernode', function() {
|
||||||
// var node = graph.nodeDataById( mapdata['v3']['centernode'] );
|
// var node = graph.nodeDataById( mapdata['v3']['centernode'] );
|
||||||
|
|||||||
Reference in New Issue
Block a user