map/graph: use sidebar.getWidth directly

This commit is contained in:
Nils Schneider 2015-07-12 00:09:57 +02:00
parent 93ca06ab75
commit 9a950a2a8e
3 changed files with 6 additions and 6 deletions

View file

@ -145,7 +145,7 @@ define(["d3"], function (d3) {
}
function getSize() {
var sidebarWidth = sidebar.getWidth()
var sidebarWidth = sidebar()
var width = el.offsetWidth - sidebarWidth
var height = el.offsetHeight
@ -153,7 +153,7 @@ define(["d3"], function (d3) {
}
function panzoomTo(a, b) {
var sidebarWidth = sidebar.getWidth()
var sidebarWidth = sidebar()
var size = getSize()
var targetWidth = Math.max(1, b[0] - a[0])
@ -476,7 +476,7 @@ define(["d3"], function (d3) {
var size = getSize()
var newSize = [size[0] / scale, size[1] / scale]
var sidebarWidth = sidebar.getWidth()
var sidebarWidth = sidebar()
var delta = [size[0] - newSize[0], size[1] - newSize[1]]
var translate = z.translate()
var translateNew = [sidebarWidth + (translate[0] - sidebarWidth - delta[0] / 2) * scale, (translate[1] - delta[1] / 2) * scale]
@ -506,7 +506,7 @@ define(["d3"], function (d3) {
zoomBehavior = d3.behavior.zoom()
.scaleExtent([1 / 3, 3])
.on("zoom", onPanZoom)
.translate([sidebar.getWidth(), 0])
.translate([sidebar(), 0])
canvas = d3.select(el)
.attr("tabindex", 1)

View file

@ -35,7 +35,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
function addContent(K) {
removeContent()
content = new K(config, linkScale, sidebar, router, buttons)
content = new K(config, linkScale, sidebar.getWidth, router, buttons)
contentDiv.appendChild(content.div)
if (latestData)

View file

@ -269,7 +269,7 @@ define(["map/clientlayer", "map/labelslayer",
}
function setView(bounds) {
map.fitBounds(bounds, {paddingTopLeft: [sidebar.getWidth(), 0]})
map.fitBounds(bounds, {paddingTopLeft: [sidebar(), 0]})
}
function resetZoom() {