mirror of
https://github.com/penpot/penpot.git
synced 2025-02-11 01:28:30 -05:00
Add matrix type to transit handlers.
This commit is contained in:
parent
462f37e601
commit
a28a6978fe
1 changed files with 13 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
[com.cognitect.transit :as tr]
|
[com.cognitect.transit :as tr]
|
||||||
[uxbox.util.data :refer (parse-int)]
|
[uxbox.util.data :refer (parse-int)]
|
||||||
[uxbox.util.geom.point :as gpt]
|
[uxbox.util.geom.point :as gpt]
|
||||||
|
[uxbox.util.geom.matrix :as gmt]
|
||||||
[uxbox.util.datetime :as dt]))
|
[uxbox.util.datetime :as dt]))
|
||||||
|
|
||||||
;; --- Transit Handlers
|
;; --- Transit Handlers
|
||||||
|
@ -34,13 +35,25 @@
|
||||||
(gpt/point (vec value))
|
(gpt/point (vec value))
|
||||||
(gpt/map->Point value)))))
|
(gpt/map->Point value)))))
|
||||||
|
|
||||||
|
(def matrix-write-handler
|
||||||
|
(t/write-handler
|
||||||
|
(constantly "matrix")
|
||||||
|
(fn [v] (into {} v))))
|
||||||
|
|
||||||
|
(def matrix-read-handler
|
||||||
|
(t/read-handler
|
||||||
|
(fn [value]
|
||||||
|
(gmt/map->Matrix value))))
|
||||||
|
|
||||||
(def ^:privare +read-handlers+
|
(def ^:privare +read-handlers+
|
||||||
{"u" uuid
|
{"u" uuid
|
||||||
"m" datetime-read-handler
|
"m" datetime-read-handler
|
||||||
|
"matrix" matrix-read-handler
|
||||||
"point" point-read-handler})
|
"point" point-read-handler})
|
||||||
|
|
||||||
(def ^:privare +write-handlers+
|
(def ^:privare +write-handlers+
|
||||||
{dt/DateTime datetime-write-handler
|
{dt/DateTime datetime-write-handler
|
||||||
|
gmt/Matrix matrix-write-handler
|
||||||
gpt/Point point-write-handler})
|
gpt/Point point-write-handler})
|
||||||
|
|
||||||
;; --- Public Api
|
;; --- Public Api
|
||||||
|
|
Loading…
Add table
Reference in a new issue