mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 16:21:57 -05: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
|
||||
"Returns the points in the given content"
|
||||
[content]
|
||||
(->> content
|
||||
(map #(when (-> % :params :x)
|
||||
(gpt/point (-> % :params :x) (-> % :params :y))))
|
||||
(remove nil?)
|
||||
(into [])))
|
||||
(letfn [(segment->point [seg]
|
||||
(let [params (get seg :params)
|
||||
x (get params :x)
|
||||
y (get params :y)]
|
||||
(when (d/num? x y)
|
||||
(gpt/point x y))))]
|
||||
(some->> (seq content)
|
||||
(into [] (keep segment->point)))))
|
||||
|
||||
(defn line-values
|
||||
[[from-p to-p] t]
|
||||
|
|
Loading…
Add table
Reference in a new issue