mirror of
https://github.com/penpot/penpot.git
synced 2025-04-01 09:31:26 -05:00
Merge pull request #3715 from penpot/niwinz-develop-bugfixes-14
🐛 Fix issues on importation version handling and bool shapes initialization
This commit is contained in:
commit
a49bc07259
4 changed files with 25 additions and 5 deletions
|
@ -680,12 +680,17 @@
|
|||
|
||||
(let [file-id' (lookup-index file-id)
|
||||
data (-> (:data file)
|
||||
(assoc :id file-id')
|
||||
(assoc :id file-id'))
|
||||
|
||||
data (if (> (:version data) cfd/version)
|
||||
(assoc data :version cfd/version)
|
||||
data)
|
||||
|
||||
data (-> data
|
||||
(cond-> migrate? (pmg/migrate-data))
|
||||
(update :pages-index relink-shapes)
|
||||
(update :components relink-shapes)
|
||||
(update :media relink-media)
|
||||
(assoc :version cfd/version)
|
||||
(postprocess-file))
|
||||
|
||||
params {:id file-id'
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
|
||||
(ns app.common.files.defaults)
|
||||
|
||||
(def version 33)
|
||||
(def version 34)
|
||||
|
|
|
@ -624,3 +624,17 @@
|
|||
(update container :objects update-vals update-object))]
|
||||
(-> data
|
||||
(update :pages-index update-vals update-container))))
|
||||
|
||||
(defmethod migrate 34
|
||||
[data]
|
||||
(letfn [(update-object [object]
|
||||
(if (or (cph/path-shape? object)
|
||||
(cph/bool-shape? object))
|
||||
(dissoc object :x :y :width :height)
|
||||
object))
|
||||
(update-container [container]
|
||||
(update container :objects update-vals update-object))]
|
||||
(-> data
|
||||
(update :pages-index update-vals update-container)
|
||||
(update :components update-vals update-container))))
|
||||
|
||||
|
|
|
@ -433,7 +433,8 @@
|
|||
attrs (get-minimal-shape type)]
|
||||
|
||||
(cond-> attrs
|
||||
(not= :path type)
|
||||
(and (not= :path type)
|
||||
(not= :bool type))
|
||||
(-> (assoc :x 0)
|
||||
(assoc :y 0)
|
||||
(assoc :width 0.01)
|
||||
|
@ -481,7 +482,7 @@
|
|||
(let [shape (make-minimal-shape type)
|
||||
shape (merge shape (d/without-nils props))
|
||||
shape (case (:type shape)
|
||||
:path (setup-path shape)
|
||||
(:bool :path) (setup-path shape)
|
||||
:image (-> shape setup-rect setup-image)
|
||||
(setup-rect shape))]
|
||||
(-> shape
|
||||
|
|
Loading…
Add table
Reference in a new issue