 
 
 
-(defn handle-unslected [clicked-what world-state]
+(defn make-new-vertex [where {:keys [vertices]}]
+  (let [new-key (next-key vert-id vertices)]
+    [new-key [1 where]]))
+
+
+
+(defn add-vertex [event world-state]
+  (let [where (where-svg-was-clicked event)
+        new-vertex (make-new-vertex where world-state)]
+    (update-in world-state [:vertices] #(conj % new-vertex))))
+
+
+
+(defn handle-unslected [clicked-what event world-state]
   (let [clicked-edge? (re-matches edge-regex clicked-what)
         clicked-vertex? (re-matches vertex-regex clicked-what)]
     (cond
         clicked-edge? (toggle-edge-value world-state clicked-what)
         clicked-vertex? (select-vertex world-state clicked-what)
-        :else world-state)))
+        :else (add-vertex event world-state))))
 
 
 




(defn make-new-edge [from to world-state]
  (let [next-to-largest-key (next-key (largest-key world-state))]
    [next-to-largest-key [from to :red]]))




  (:require [constraint.common :refer [edge-id
                                       vert-id]]))

(def vertex-regex (re-pattern (str vert-id ".*")))
(def edge-regex (re-pattern (str edge-id ".*")))

