Pārlūkot izejas kodu

map/graph: use sidebar.getWidth directly

Nils Schneider 8 gadi atpakaļ
vecāks
revīzija
9a950a2a8e
3 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. 4 4
      lib/forcegraph.js
  2. 1 1
      lib/gui.js
  3. 1 1
      lib/map.js

+ 4 - 4
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)

+ 1 - 1
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)

+ 1 - 1
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() {