                                           (aget e "pageY")
                                           :clear? true
                                           :color "green"))))
+
+(defn re-render!
+  [new-state]
+  (add-overlay-rectangle!
+   0 0
+   (aget overlay-canvas "width") (aget overlay-canvas "height")
+   :opacity 0.2 :color "green" :clear? true :type :fill)
+
+  (.setTimeout js/window #(render-mandelbrot! new-state) 50))
 
 
 (defn zoom-to-enclose-rectangle!


  (println render-state)

  (make-canvases-fill-window!)

  (let [max-iterations        (int (* 10 (Math/log scale))) ; Sensible?
        start                 (.getTime (js/Date.))


(set! (.-onmouseup overlay-canvas) handle-mouseup)

(set! (.-onresize js/window) (fn [] (re-render! @app-state)))

(add-watch app-state :state-changed
           (fn [_ _ old-state new-state]
             (when-not (= (:rendering-data old-state)
                          (:rendering-data new-state))
               (re-render! new-state))))

(render-mandelbrot! @app-state)

