map/graph: use sidebar.getWidth directly
This commit is contained in:
parent
93ca06ab75
commit
9a950a2a8e
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user