This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-13
Channels
- # beginners (99)
- # boot (2)
- # boot-dev (4)
- # chestnut (2)
- # cider (75)
- # clara (43)
- # cljs-dev (1)
- # cljsjs (6)
- # cljsrn (4)
- # clojars (2)
- # clojure (76)
- # clojure-brasil (1)
- # clojure-france (1)
- # clojure-italy (2)
- # clojure-spec (30)
- # clojure-uk (4)
- # clojurescript (39)
- # core-async (1)
- # core-logic (2)
- # cursive (1)
- # data-science (7)
- # datomic (14)
- # docker (12)
- # emacs (6)
- # fulcro (69)
- # garden (4)
- # hoplon (7)
- # jobs-discuss (46)
- # leiningen (3)
- # lumo (3)
- # off-topic (12)
- # om (2)
- # parinfer (12)
- # perun (9)
- # re-frame (44)
- # reagent (6)
- # rum (1)
- # shadow-cljs (73)
- # specter (5)
- # unrepl (10)
- # vim (2)
@flyboarder well to get a useful "dragleave" event using the dnd api you need to count dragenter/dragleave events because they trigger on some nested elements too
so i end up with something like
:dragenter (fn [e]
(wheel.dom.events/prevent-default e)
(swap! drag-enters update (-> e .-originalEvent .-target) inc))
:dragleave (fn [e]
(wheel.dom.events/prevent-default e)
; use a RAF to ensure leave is always called after enter but
; avoid the UI jank that a regular timeout would incur
(.requestAnimationFrame js/window
#(swap! drag-enters update (-> e .-originalEvent .-target) dec)))
which really seems like something i should bundle up for re-use
so i was assuming that i'd need to namespace the :dragenter
and :dragleave
attributes and put them in a fn that applies them to a passed element - namespacing would be to ensure that the element can have other things bound to the same events
although, i haven't tested it yet, it might already work as event handling and attributes are different things
@thedavidmeister so for that I would just namespace it