mirror of
https://github.com/status-im/re-frame-10x.git
synced 2025-02-05 10:53:23 +00:00
Temp working point
This commit is contained in:
parent
b3d64dd7a8
commit
c6384dcd74
@ -228,7 +228,8 @@
|
||||
[force-outer traces-ratom]
|
||||
[:hr]
|
||||
[:h2 {:on-click #(swap! desc inc)} "Click"]
|
||||
[(d3t/create-d3 {:render-component (fn [ratom]
|
||||
[(d3t/create-d3
|
||||
{:render-component (fn [ratom]
|
||||
[:div
|
||||
[:h1 (str "SVG")]
|
||||
[:svg#d3cmp {:width width :height height}]])
|
||||
@ -277,8 +278,6 @@
|
||||
(attr "stroke-width" (fn [d] (Math/sqrt (.-value d))))
|
||||
)
|
||||
|
||||
link-sel (.. svg
|
||||
(selectAll ".links > line"))
|
||||
|
||||
node (.. (. svg append "g")
|
||||
(attr "class" "nodes")
|
||||
@ -297,18 +296,22 @@
|
||||
(on "drag" dragged)
|
||||
(on "end" dragended))))
|
||||
|
||||
circle-sel (.. svg
|
||||
(selectAll ".node > circle"))
|
||||
|
||||
|
||||
label (.. node
|
||||
(append "text")
|
||||
(attr "dy" ".35em")
|
||||
(text #(gob/get % "title" "")))
|
||||
|
||||
label-sel (.. svg
|
||||
(selectAll ".node > text"))
|
||||
|
||||
|
||||
ticked (fn []
|
||||
(let [link-sel (.. svg
|
||||
(selectAll ".links > line"))
|
||||
circle-sel (.. svg
|
||||
(selectAll ".node > circle"))
|
||||
label-sel (.. svg
|
||||
(selectAll ".node > text"))]
|
||||
(.. link-sel
|
||||
(attr "x1" (fn [d] (.. d -source -x)))
|
||||
(attr "y1" (fn [d] (.. d -source -y)))
|
||||
@ -319,18 +322,19 @@
|
||||
(attr "cy" (fn [d] (min-max (.. d -r) (.. d -y) (- height (.. d -r))))))
|
||||
(.. label-sel
|
||||
(attr "x" #(+ (.-x %) 2 (.-r %)))
|
||||
(attr "y" #(+ (.-y %))))
|
||||
(attr "y" #(+ (.-y %)))))
|
||||
nil)
|
||||
]
|
||||
|
||||
(.. simulation
|
||||
(nodes nodes)
|
||||
(on "tick" ticked))
|
||||
|
||||
(.. simulation
|
||||
(force "link")
|
||||
(links links))))
|
||||
(links links))
|
||||
))
|
||||
:d3-enter (fn [ratom]
|
||||
|
||||
(let [graph (trace->sub-graph @ratom)
|
||||
nodes (clj->js (:nodes graph))
|
||||
links (clj->js (:links graph))
|
||||
@ -338,6 +342,9 @@
|
||||
svg @svg-a
|
||||
color @color-a
|
||||
simulation @simulation-a
|
||||
_ (js/console.log "d3ent" (.. svg
|
||||
(selectAll ".links > line")
|
||||
size))
|
||||
|
||||
dragstarted (fn [d]
|
||||
(when (zero? (.. js/d3 -event -active))
|
||||
@ -395,12 +402,10 @@
|
||||
(.. simulation
|
||||
(force "link")
|
||||
(links links))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(println "D3 did enter"))}
|
||||
(println "D3 did enter")
|
||||
(js/console.log "d3 ent done" (.. svg
|
||||
(selectAll ".links > line")
|
||||
size))))}
|
||||
traces-ratom)]
|
||||
[:hr]])))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user