mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 07:46:42 +02:00
⚡ Optimize content->points helper
This commit is contained in:
parent
e833e29bd4
commit
2c61cfd139
1 changed files with 8 additions and 5 deletions
|
@ -46,11 +46,14 @@
|
||||||
(defn content->points
|
(defn content->points
|
||||||
"Returns the points in the given content"
|
"Returns the points in the given content"
|
||||||
[content]
|
[content]
|
||||||
(->> content
|
(letfn [(segment->point [seg]
|
||||||
(map #(when (-> % :params :x)
|
(let [params (get seg :params)
|
||||||
(gpt/point (-> % :params :x) (-> % :params :y))))
|
x (get params :x)
|
||||||
(remove nil?)
|
y (get params :y)]
|
||||||
(into [])))
|
(when (d/num? x y)
|
||||||
|
(gpt/point x y))))]
|
||||||
|
(some->> (seq content)
|
||||||
|
(into [] (keep segment->point)))))
|
||||||
|
|
||||||
(defn line-values
|
(defn line-values
|
||||||
[[from-p to-p] t]
|
[[from-p to-p] t]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue