Skip to content

Instantly share code, notes, and snippets.

View vlaaad's full-sized avatar
💭
🔥

vlaaad vlaaad

💭
🔥
View GitHub Profile
;; deps are:
;; {org.apache.xmlgraphics/batik-codec {:mvn/version "1.9.1"}
;; clj-http/clj-http {:mvn/version "3.12.3"}
;; org.clojure/data.json {:mvn/version "2.4.0"}}
(import '[org.apache.batik.svggen SVGGraphics2D]
'[org.apache.batik.dom GenericDOMImplementation]
'[java.awt Font])
(require '[clj-http.client :as http]
'[clojure.data.json :as json])
@vlaaad
vlaaad / deps.edn
Created February 25, 2019 23:10
fn-fx dragging example
{:deps {;; does not work, needs JDK 8 with JavaFX
;; halgari/fn-fx {:mvn/version "0.4.0"}
;; works, needs JDK 11
fn-fx/fn-fx-openjfx11 {:mvn/version "0.5.0-SNAPSHOT"}}
:paths ["."]
:aliases {:wayland {:jvm-opts ["-Djdk.gtk.version=2"]}}}

Map events

Consider this example:

(defn todo-view [{:keys [text id done]}]
  {:fx/type :h-box
   :children [{:fx/type :check-box
               :selected done
 :on-selected-changed #(swap! *state assoc-in [:by-id id :done] %)
@vlaaad
vlaaad / gist:725ac16543f6b5f545d5
Created July 1, 2014 10:52
Libgdx pinch zoom + pan listener
private EventListener dragListener = new ActorGestureListener() {
private float initialScale;
private float iX;
private float iY;
@Override
public void touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (event.getTarget() != stage.getRoot())
return;