mirror of
https://github.com/penpot/penpot.git
synced 2025-01-11 01:10:28 -05:00
🐛 Fixes problems with previous migration
This commit is contained in:
parent
ef9b0062dd
commit
0fcfd30535
3 changed files with 27 additions and 9 deletions
|
@ -148,14 +148,17 @@
|
|||
(assert (point? p))
|
||||
(assert (point? other))
|
||||
|
||||
(let [a (/ (+ (* x ox)
|
||||
(* y oy))
|
||||
(* (length p)
|
||||
(length other)))
|
||||
a (mth/acos (if (< a -1) -1 (if (> a 1) 1 a)))
|
||||
d (-> (mth/degrees a)
|
||||
(mth/precision 6))]
|
||||
(if (mth/nan? d) 0 d)))
|
||||
(if (or (= 0 (length p))
|
||||
(= 0 (length other)))
|
||||
0
|
||||
(let [a (/ (+ (* x ox)
|
||||
(* y oy))
|
||||
(* (length p)
|
||||
(length other)))
|
||||
a (mth/acos (if (< a -1) -1 (if (> a 1) 1 a)))
|
||||
d (-> (mth/degrees a)
|
||||
(mth/precision 6))]
|
||||
(if (mth/nan? d) 0 d))))
|
||||
|
||||
|
||||
(defn update-angle
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]))
|
||||
|
||||
(def file-version 3)
|
||||
(def file-version 4)
|
||||
(def max-safe-int 9007199254740991)
|
||||
(def min-safe-int -9007199254740991)
|
||||
|
||||
|
|
|
@ -109,3 +109,18 @@
|
|||
(update page :objects #(d/mapm update-object %)))]
|
||||
|
||||
(update data :pages-index #(d/mapm update-page %))))
|
||||
|
||||
(defmethod migrate 4
|
||||
[data]
|
||||
(letfn [(update-object [id object]
|
||||
(cond-> object
|
||||
(= (:id object) uuid/zero)
|
||||
(assoc :points []
|
||||
:selrect {:x 0 :y 0
|
||||
:width 1 :height 1
|
||||
:x1 0 :y1 0
|
||||
:x2 1 :y2 1})))
|
||||
|
||||
(update-page [id page]
|
||||
(update page :objects #(d/mapm update-object %)))]
|
||||
(update data :pages-index #(d/mapm update-page %))))
|
||||
|
|
Loading…
Reference in a new issue