🐛 Fix incompatibilities of old file migrations with new code

This commit is contained in:
Andrey Antukh 2024-01-29 15:25:27 +01:00
parent 04be6b13be
commit 295d9568c8

View file

@ -109,11 +109,14 @@
(assoc :points (grc/rect->points selrect)))))) (assoc :points (grc/rect->points selrect))))))
(fix-empty-points [shape] (fix-empty-points [shape]
(let [shape (cond-> shape (if (empty? (:points shape))
(empty? (:selrect shape)) (cts/setup-rect))] (-> shape
(cond-> shape (update :selrect (fn [selrect]
(empty? (:points shape)) (if (map? selrect)
(assoc :points (grc/rect->points (:selrect shape)))))) (grc/make-rect selrect)
selrect)))
(cts/setup-shape))
shape))
(update-object [object] (update-object [object]
(cond-> object (cond-> object
@ -857,4 +860,4 @@
(update-container [container] (update-container [container]
(d/update-when container :objects update-vals fix-shape))] (d/update-when container :objects update-vals fix-shape))]
(-> data (-> data
(update :pages-index update-vals update-container)))) (update :pages-index update-vals update-container))))