From 9a950a2a8e6f291353b6f13e3e37ff8a486f1f4e Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 12 Jul 2015 00:09:57 +0200 Subject: [PATCH] map/graph: use sidebar.getWidth directly --- lib/forcegraph.js | 8 ++++---- lib/gui.js | 2 +- lib/map.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 1c6dd55..c760b15 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -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) diff --git a/lib/gui.js b/lib/gui.js index 0ac08c0..830fe8f 100644 --- a/lib/gui.js +++ b/lib/gui.js @@ -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) diff --git a/lib/map.js b/lib/map.js index 66ead33..c54877a 100644 --- a/lib/map.js +++ b/lib/map.js @@ -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() {