Add get-points helper, a faster alternative to content->points

This commit is contained in:
Andrey Antukh 2025-04-03 00:12:13 +02:00
parent 230e330eb2
commit da2f519805

View File

@ -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))