mirror of
https://github.com/penpot/penpot.git
synced 2026-05-11 02:58:25 +00:00
⚡ Add get-points helper, a faster alternative to content->points
This commit is contained in:
parent
230e330eb2
commit
da2f519805
@ -166,6 +166,16 @@
|
||||
(some->> (seq content)
|
||||
(into [] (keep segment->point)))))
|
||||
|
||||
(defn get-points
|
||||
"Returns points for the given segment, faster version of
|
||||
the `content->points`."
|
||||
[content]
|
||||
(impl/with-cache content "get-points"
|
||||
(impl/-walk content
|
||||
(fn [type _ _ _ _ x y]
|
||||
(when (not= type :close-path)
|
||||
(gpt/point x y))))))
|
||||
|
||||
(defn segments->content
|
||||
([segments]
|
||||
(segments->content segments false))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user