 (defonce engine (atom nil))
 
 (defn -start [this internal-stage]
-  (.setTitle internal-stage "hello world")
+  (.setTitle internal-stage "SVG Output")
   (let [internal-webview (WebView.)
         internal-engine (.getEngine internal-webview)
         layout (VBox. 0.0)

(defn render
  ([filename t]
   (export-to-file filename t)
   (render t))
  ([t]
   (let [body [:body (style
                       :margin "0 !important"

          (= Worker$State/CANCELLED state) state
          :else (do (Thread/sleep 10) (recur)))))

(defn bootstrap []
  (if @engine
    nil
    (do
      (launch)
      (.await latch))))

(defn render-string [s]
  (Platform/runLater (fn [] (.loadContent @engine s "text/html")))
  (wait-for-worker))

(defn translate [x y]
  (str "translate(" x "," y ")"))
