erge remote-tracking branch 'origin/staging'

This commit is contained in:
Alejandro Alonso 2024-04-09 12:56:04 +02:00
commit 227b2fe085
4 changed files with 25 additions and 25 deletions

View File

@ -479,7 +479,9 @@
(doseq [[feature file-id] (-> *state* deref :pending-to-migrate)] (doseq [[feature file-id] (-> *state* deref :pending-to-migrate)]
(case feature (case feature
"components/v2" "components/v2"
(feat.compv2/migrate-file! cfg file-id :validate? (::validate cfg true)) (feat.compv2/migrate-file! cfg file-id
:validate? (::validate cfg true)
:skip-on-graphic-error? true)
"fdata/shape-data-type" "fdata/shape-data-type"
nil nil

View File

@ -1600,29 +1600,28 @@
nil nil
true)) true))
new-shapes (volatile! []) new-shapes (volatile! [])
add-shape #(vswap! new-shapes conj %)
add-shape (fn [shape]
(vswap! new-shapes conj shape))
fdata' (create-media-grid fdata page-id (:id frame) grid assets add-shape) fdata' (create-media-grid fdata page-id (:id frame) grid assets add-shape)
;; When svgs had different width&height and viewport, sometimes the old graphics ;; When svgs had different width&height and viewport,
;; importer didn't calculate well the media object size. So, after migration we ;; sometimes the old graphics importer didn't
;; recalculate grid size from the actual size of the created shapes. ;; calculate well the media object size. So, after
new-grid (ctst/generate-shape-grid @new-shapes position grid-gap) ;; migration we recalculate grid size from the actual
;; size of the created shapes.
{new-width :width new-height :height} (meta new-grid) fdata' (if-let [grid (ctst/generate-shape-grid @new-shapes position grid-gap)]
(let [{new-width :width new-height :height} (meta grid)]
fdata'' (if-not (and (mth/close? width new-width) (mth/close? height new-height)) (if-not (and (mth/close? width new-width) (mth/close? height new-height))
(do (do
(l/inf :hint "fixing graphics sizes" (l/inf :hint "fixing graphics sizes"
:file-id (str (:id fdata)) :file-id (str (:id fdata))
:group group-name) :group group-name)
(fix-graphics-size fdata' new-grid page-id (:id frame))) (fix-graphics-size fdata' grid page-id (:id frame)))
fdata')] fdata'))
fdata')]
(recur (next groups) (recur (next groups)
fdata'' fdata'
(gpt/add position (gpt/point 0 (+ height (* 2 grid-gap) frame-gap)))))))))) (gpt/add position (gpt/point 0 (+ height (* 2 grid-gap) frame-gap))))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -509,7 +509,7 @@
(every? nil?)))] (every? nil?)))]
(or (or
;;We don't want to change the structure of component copies ;;We don't want to change the structure of component copies
(ctk/in-component-copy? parent) (has-any-copy-parent? objects parent)
;; If we are moving something containing a main instance the container can't be part of a component (neither main nor copy) ;; If we are moving something containing a main instance the container can't be part of a component (neither main nor copy)
(and selected-main-instance? parent-in-component?) (and selected-main-instance? parent-in-component?)
;; Avoid placing a shape as a direct or indirect child of itself, ;; Avoid placing a shape as a direct or indirect child of itself,

View File

@ -461,16 +461,15 @@
row-size (+ (reduce d/max ##-Inf (map :height bounds)) gap) row-size (+ (reduce d/max ##-Inf (map :height bounds)) gap)
column-size (+ (reduce d/max ##-Inf (map :width bounds)) gap) column-size (+ (reduce d/max ##-Inf (map :width bounds)) gap)
get-next (fn get-next get-next (fn get-next [counter]
[counter]
(let [row (quot counter grid-size) (let [row (quot counter grid-size)
column (mod counter grid-size) column (mod counter grid-size)
position (->> (gpt/point (* column column-size) position (->> (gpt/point (* column column-size)
(* row row-size)) (* row row-size))
(gpt/add start-position))] (gpt/add start-position))]
(lazy-seq (cons position
(cons position (get-next (inc counter))))))] (lazy-seq
(get-next (inc counter))))))]
(with-meta (get-next 0) (with-meta (get-next 0)
{:width (* grid-size column-size) {:width (* grid-size column-size)
:height (* grid-size row-size)})))) :height (* grid-size row-size)}))))