0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 00:58:26 -05:00

Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2024-04-09 10:05:51 +02:00
commit 171320d1c0
3 changed files with 24 additions and 24 deletions

View file

@ -479,7 +479,9 @@
(doseq [[feature file-id] (-> *state* deref :pending-to-migrate)]
(case feature
"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"
nil

View file

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

View file

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