map/graph: implement render

This commit is contained in:
Nils Schneider 2015-07-12 00:11:18 +02:00
parent 9a950a2a8e
commit a95f466f3f
3 changed files with 16 additions and 4 deletions

View File

@ -501,7 +501,6 @@ define(["d3"], function (d3) {
el = document.createElement("div")
el.classList.add("graph")
self.div = el
zoomBehavior = d3.behavior.zoom()
.scaleExtent([1 / 3, 3])
@ -699,6 +698,13 @@ define(["d3"], function (d3) {
force.stop()
canvas.remove()
force = null
if (el.parentNode)
el.parentNode.removeChild(el)
}
self.render = function (d) {
d.appendChild(el)
}
return self

View File

@ -28,7 +28,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
router.removeTarget(content)
dataTargetRemove(content)
content.destroy()
contentDiv.removeChild(content.div)
content = null
}
@ -36,7 +36,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
removeContent()
content = new K(config, linkScale, sidebar.getWidth, router, buttons)
contentDiv.appendChild(content.div)
content.render(contentDiv)
if (latestData)
content.setData(latestData)

View File

@ -207,7 +207,6 @@ define(["map/clientlayer", "map/labelslayer",
var el = document.createElement("div")
el.classList.add("map")
self.div = el
map = L.map(el, options)
@ -435,6 +434,13 @@ define(["map/clientlayer", "map/labelslayer",
self.destroy = function () {
clearButtons()
map.remove()
if (el.parentNode)
el.parentNode.removeChild(el)
}
self.render = function (d) {
d.appendChild(el)
}
return self