   {:svg svg
    :view-size (math-vec width height)
    :camera-pos (math-vec 0 0)
-   :nodes []})
+   :nodes []
+   :edges []})
 
 (defn swap-state! [current-state f & args]
   (apply swap! current-state f args)

    (project-radius r)))

(defn sync-graph! [state]
  (let [{:keys [svg nodes]} state
        _view-position (fn [d] (view-position state (:pos d)))
        view-x (comp :x _view-position)
        view-y (comp :y _view-position)
        _view-radius (fn [d] (view-radius state (:pos d)))]
    (-> svg
        (.selectAll ".node")
        (.data (apply array nodes))
        (.attr "cx" view-x)
        (.attr "cy" view-y)

        current-state (atom (initial-state svg width height))
        gesture-manager (hammer-manager svg)]
    (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)
                (move-camera-on-pan! gesture-manager current-state)
                (move-camera-on-swipe! gesture-manager current-state)
                (zoom-out-on-pinch! gesture-manager current-state)))
