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() {
|
function getSize() {
|
||||||
var sidebarWidth = sidebar.getWidth()
|
var sidebarWidth = sidebar()
|
||||||
var width = el.offsetWidth - sidebarWidth
|
var width = el.offsetWidth - sidebarWidth
|
||||||
var height = el.offsetHeight
|
var height = el.offsetHeight
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ define(["d3"], function (d3) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function panzoomTo(a, b) {
|
function panzoomTo(a, b) {
|
||||||
var sidebarWidth = sidebar.getWidth()
|
var sidebarWidth = sidebar()
|
||||||
var size = getSize()
|
var size = getSize()
|
||||||
|
|
||||||
var targetWidth = Math.max(1, b[0] - a[0])
|
var targetWidth = Math.max(1, b[0] - a[0])
|
||||||
|
@ -476,7 +476,7 @@ define(["d3"], function (d3) {
|
||||||
var size = getSize()
|
var size = getSize()
|
||||||
var newSize = [size[0] / scale, size[1] / scale]
|
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 delta = [size[0] - newSize[0], size[1] - newSize[1]]
|
||||||
var translate = z.translate()
|
var translate = z.translate()
|
||||||
var translateNew = [sidebarWidth + (translate[0] - sidebarWidth - delta[0] / 2) * scale, (translate[1] - delta[1] / 2) * scale]
|
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()
|
zoomBehavior = d3.behavior.zoom()
|
||||||
.scaleExtent([1 / 3, 3])
|
.scaleExtent([1 / 3, 3])
|
||||||
.on("zoom", onPanZoom)
|
.on("zoom", onPanZoom)
|
||||||
.translate([sidebar.getWidth(), 0])
|
.translate([sidebar(), 0])
|
||||||
|
|
||||||
canvas = d3.select(el)
|
canvas = d3.select(el)
|
||||||
.attr("tabindex", 1)
|
.attr("tabindex", 1)
|
||||||
|
|
|
@ -35,7 +35,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
|
||||||
function addContent(K) {
|
function addContent(K) {
|
||||||
removeContent()
|
removeContent()
|
||||||
|
|
||||||
content = new K(config, linkScale, sidebar, router, buttons)
|
content = new K(config, linkScale, sidebar.getWidth, router, buttons)
|
||||||
contentDiv.appendChild(content.div)
|
contentDiv.appendChild(content.div)
|
||||||
|
|
||||||
if (latestData)
|
if (latestData)
|
||||||
|
|
|
@ -269,7 +269,7 @@ define(["map/clientlayer", "map/labelslayer",
|
||||||
}
|
}
|
||||||
|
|
||||||
function setView(bounds) {
|
function setView(bounds) {
|
||||||
map.fitBounds(bounds, {paddingTopLeft: [sidebar.getWidth(), 0]})
|
map.fitBounds(bounds, {paddingTopLeft: [sidebar(), 0]})
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetZoom() {
|
function resetZoom() {
|
||||||
|
|
Loading…
Reference in a new issue