0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

🐛 Fix geometry sync for subcomponents

This commit is contained in:
Andrés Moya 2021-07-01 16:55:31 +02:00 committed by Alonso Torres
parent 5f1ed511ea
commit c98958053c

View file

@ -631,20 +631,14 @@
set-remote-synced?))) set-remote-synced?)))
both (fn [child-inst child-main] both (fn [child-inst child-main]
(let [sub-root? (and (:component-id shape-inst) (generate-sync-shape-direct-recursive container
(not (:component-root? shape-inst)))] child-inst
(generate-sync-shape-direct-recursive container component
child-inst child-main
component root-inst
child-main root-main
(if sub-root? reset?
shape-inst initial-root?))
root-inst)
(if sub-root?
shape-main
root-main)
reset?
initial-root?)))
moved (fn [child-inst child-main] moved (fn [child-inst child-main]
(move-shape (move-shape
@ -752,20 +746,13 @@
false)) false))
both (fn [child-inst child-main] both (fn [child-inst child-main]
(let [sub-root? (and (:component-id shape-inst) (generate-sync-shape-inverse-recursive container
(not (:component-root? shape-inst)))] child-inst
component
(generate-sync-shape-inverse-recursive container child-main
child-inst root-inst
component root-main
child-main initial-root?))
(if sub-root?
shape-inst
root-inst)
(if sub-root?
shape-main
root-main)
initial-root?)))
moved (fn [child-inst child-main] moved (fn [child-inst child-main]
(move-shape (move-shape
@ -1160,6 +1147,8 @@
; sync only the position relative to the origin of the component. ; sync only the position relative to the origin of the component.
; We solve this by moving the origin shape so it is aligned with ; We solve this by moving the origin shape so it is aligned with
; the dest root before syncing. ; the dest root before syncing.
; In case of subinstances, the comparison is always done with the
; near component, because this is that we are syncing with.
origin-shape (reposition-shape origin-shape origin-root dest-root) origin-shape (reposition-shape origin-shape origin-root dest-root)
touched (get dest-shape :touched #{})] touched (get dest-shape :touched #{})]