   (let [element (-> d3 (.select selector) .node)
         width (.-clientWidth element)
         height (.-clientHeight element)
-        svg (setup-svg! selector width height)
+        svg (setup-svg! selector)
         gesture-manager (hammer-manager svg)
         animation-subject (animation-subject)
         node-tap-subject (js/Rx.Subject.)

                                           animation-subject
                                           node-tap-subject
                                           link-tap-subject))]
    (sync-graph! @current-state)
    (load-graph "miserables.json"
                (fn [graph]
                  (let [{:keys [nodes links]} graph]
                    (swap-state! current-state assoc :nodes nodes :links links))))
    (move-camera-on-arrow-keys! current-state animation-subject)
    (move-camera-on-pan! gesture-manager current-state animation-subject)
    (move-camera-on-swipe! gesture-manager current-state animation-subject)


(def zoom-out-scale 0.25)

(def resize-delay-ms 100)

;; SVG setup

(defn disable-touchmove! [container]
  (.on container "touchmove" #(-> d3 .-event .preventDefault)))

(defn add-background! [svg]
  (-> svg
      (.append "rect")
      (.attr "class" "background")
      (.attr "fill" "#EDF0F2")
      (.attr "stroke" 0)))

(defn setup-svg! [selector]
  (let [container (.select d3 selector)
        svg (-> container
                (.append "svg"))]
    (disable-touchmove! container)
    (add-background! svg)
    svg))

;; Geometry
