mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 15:51:37 -05:00
✨ Improves matrix serialization
This commit is contained in:
parent
984187037c
commit
f2fd380979
1 changed files with 17 additions and 8 deletions
|
@ -19,7 +19,6 @@
|
||||||
(def precision 6)
|
(def precision 6)
|
||||||
|
|
||||||
;; --- Matrix Impl
|
;; --- Matrix Impl
|
||||||
|
|
||||||
(defrecord Matrix [^double a
|
(defrecord Matrix [^double a
|
||||||
^double b
|
^double b
|
||||||
^double c
|
^double c
|
||||||
|
@ -28,13 +27,23 @@
|
||||||
^double f]
|
^double f]
|
||||||
Object
|
Object
|
||||||
(toString [_]
|
(toString [_]
|
||||||
(str "matrix("
|
#?(:clj
|
||||||
(mth/precision a precision) ","
|
(dm/fmt "matrix(%, %, %, %, %, %)"
|
||||||
(mth/precision b precision) ","
|
(mth/precision a precision)
|
||||||
(mth/precision c precision) ","
|
(mth/precision b precision)
|
||||||
(mth/precision d precision) ","
|
(mth/precision c precision)
|
||||||
(mth/precision e precision) ","
|
(mth/precision d precision)
|
||||||
(mth/precision f precision) ")")))
|
(mth/precision e precision)
|
||||||
|
(mth/precision f precision))
|
||||||
|
|
||||||
|
:cljs
|
||||||
|
(dm/fmt "matrix(%, %, %, %, %, %)"
|
||||||
|
(.toFixed a precision)
|
||||||
|
(.toFixed b precision)
|
||||||
|
(.toFixed c precision)
|
||||||
|
(.toFixed d precision)
|
||||||
|
(.toFixed e precision)
|
||||||
|
(.toFixed f precision)))))
|
||||||
|
|
||||||
(defn matrix?
|
(defn matrix?
|
||||||
"Return true if `v` is Matrix instance."
|
"Return true if `v` is Matrix instance."
|
||||||
|
|
Loading…
Add table
Reference in a new issue