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

View file

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

View file

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