       (v/add view-center
              (v/multiply displacement (/ projected-r r))))))
 
-(defn project-radius [t]
-  (* max-radius (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25)))))))
+(defn project-scale [t]
+  (min 1 (/ 1 (.pow js/Math 2 (* 2 (- t 0.25))))))
 
 (defn project-opacity [t]
   (cond

    (<= 2 t 3) (- 0.75 (* 0.75 (- t 2)))
    :else 0))

(def fisheye-projectors {:project-displacement project-displacement
                         :project-radius project-radius
                         :project-opacity project-opacity})

(def zoom-out-projectors {:project-displacement (partial * zoom-out-scale)
                          :project-radius (constantly (* zoom-out-scale max-radius))
                          :project-opacity (constantly 1)})

(defn projectors-for-state [state]
  (if (= (:projection state) :fisheye) fisheye-projectors zoom-out-projectors))

          (.attr "y1" #(-> % :source positions v/y))
          (.attr "x2" #(-> % :target positions v/x))
          (.attr "y2" #(-> % :target positions v/y))))
    (let [node-selection (-> svg (.selectAll ".node")
                             (.data (apply array nodes)))
          new-node-selection (-> node-selection .enter
                                 (.append "g")
                                 (.attr "class" "node"))]
      (-> new-node-selection (.append "circle")
          (.attr "class" "node-dot")
          (.style "fill" "#777A7A")
          (.attr "r" max-radius)
          (.each
            (fn [node]
              (this-as elem (add-tap-listener elem #(node-tap-signaller node))))))
      (-> new-node-selection (.append "text")
          (.attr "class" "node-label")
          (.attr "y" ".6em")
          (.attr "font-family" label-font)
          (.attr "font-size" (str label-font-size))
          (.style "text-anchor" "middle")
          (.attr "transform" label-y-transform))
      (-> node-selection
          maybe-transition
          (.attr "transform"
                 (fn [d i]
                   (let [scale (project-scale (distances-from-camera i))
                         x (v/x (positions i))
                         y (v/y (positions i))]
                     (str "translate(" x "," y ") scale(" scale ")")))))
      (-> node-selection (.selectAll ".node-label")
          maybe-transition
          (.attr "opacity" (fn [d i]
                             (project-label-opacity (distances-from-camera i))))
          (.text #(:title %))))))

;; State management

