map: show buttons along content buttons

This commit is contained in:
Nils Schneider 2015-07-07 01:56:11 +02:00
commit 144dba319e
4 changed files with 45 additions and 34 deletions

View file

@ -14,6 +14,9 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
var linkScale = chroma.scale(chroma.interpolate.bezier(["green", "yellow", "red"])).domain([1, 5])
var sidebar
var buttons = document.createElement("div")
buttons.classList.add("buttons")
function dataTargetRemove(d) {
dataTargets = dataTargets.filter( function (e) { return d !== e })
}
@ -32,7 +35,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
function addContent(K) {
removeContent()
content = new K(config, linkScale, sidebar, router)
content = new K(config, linkScale, sidebar, router, buttons)
contentDiv.appendChild(content.div)
if (latestData)
@ -54,21 +57,21 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
sidebar = new Sidebar(document.body)
contentDiv.appendChild(buttons)
var buttonToggle = document.createElement("button")
buttonToggle.classList.add("contenttoggle")
buttonToggle.classList.add("next-graph")
buttonToggle.textContent = ""
buttonToggle.onclick = function () {
if (content.constructor === Map) {
buttonToggle.classList.remove("next-graph")
buttonToggle.classList.add("next-map")
buttonToggle.textContent = ""
router.view("g")
} else {
buttonToggle.classList.remove("next-map")
buttonToggle.classList.add("next-graph")
buttonToggle.textContent = ""
router.view("m")
}
}
contentDiv.appendChild(buttonToggle)
buttons.appendChild(buttonToggle)
var title = new Title(config)
var infobox = new Infobox(config, sidebar, router)