This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-25
Channels
- # admin-announcements (1)
- # aws (1)
- # beginners (52)
- # boot (78)
- # cider (22)
- # cljs-dev (1)
- # cljsrn (6)
- # clojars (23)
- # clojure (51)
- # clojure-austin (2)
- # clojure-china (2)
- # clojure-dusseldorf (2)
- # clojure-russia (101)
- # clojure-sg (2)
- # clojure-uk (2)
- # clojurescript (53)
- # core-logic (14)
- # cursive (1)
- # editors (4)
- # hoplon (324)
- # jaunt (1)
- # juxt (4)
- # leiningen (2)
- # mount (17)
- # off-topic (4)
- # om (15)
- # onyx (15)
- # parinfer (4)
- # proton (5)
- # re-frame (26)
- # reagent (24)
- # ring-swagger (1)
- # slack-help (5)
- # spacemacs (2)
- # untangled (10)
I’m designing node-editor type GUI (think Apple’s Quartz Composer) using reagent to render SVG and I’m trying to figure out how to represent the data. There will be draggable boxes with little round sockets, which can be connected by dragging lines between them. This means I need to track individual socket coordinates in order to render lines between them. Ideally, I’d leave that information in the DOM and access it using something like a standard DOM (.getBoundingClientRect socket-element)
only when re-rendering the connections. The problem here is: how do I get socket-element
(the :circle
) if I render boxes this way: (defn box [b] [:g [:rect …] (for [s (:sockets b)] [:circle {… s ...}])]
or maybe I should track coordinates inside the atom of everything and swap! them whenever boxes change?
but I still need to get the real coordinates, whuch are calculated by svg after applying all transforms etc.
@nooga: you can select these circles using standard document.querySelector
inside :component-did-mount
ids or some data-
attributes. Maybe React ref
s can be used here but i'm not sure it can be used with lists
hi, changed a bunch of stuff and now i’m getting "Uncaught Error: Assert failed: Could not find ReactDOMServer”. Using re-frame + figwheel. Can’t find the cause, any idea?
fixed. but not sure how it resulted in that error message. I had a problem with logic in a ui function which returned an empty vector
actually still getting the error message but app is running fine as far as i can tell
i think this fixes it but its not out yet: https://github.com/reagent-project/reagent/commit/f76bce6a2f559deaec6f392203add9521cb7c197
I have a component that contains a button and an input, how do I set focus on the input from the button onClick event handler?
@afhammad: here is an example using (reagent/dom-node this): https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/draggable
@afhammad: https://github.com/reagent-project/reagent/issues/5 (note: cloact is the former name of reagent
thanks @gadfly361 @rafd. all the examples i see are from within component-did-mount, it seems like the only way to access the dom node, which makes it tricky to access from a different element (i.e the button being clicked)