mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 19:06:10 +02:00
:bug Fix calculate position of subcomponents on sync
This commit is contained in:
parent
bb5d0b63ef
commit
6453cb9d11
1 changed files with 36 additions and 36 deletions
|
@ -403,14 +403,7 @@
|
||||||
:component (:name component)
|
:component (:name component)
|
||||||
:options options)
|
:options options)
|
||||||
|
|
||||||
(let [root-inst (if (:component-id shape-inst)
|
(let [[rchanges uchanges]
|
||||||
shape-inst
|
|
||||||
root-inst)
|
|
||||||
root-master (if (:component-id shape-inst)
|
|
||||||
shape-master
|
|
||||||
root-master)
|
|
||||||
|
|
||||||
[rchanges uchanges]
|
|
||||||
(concat-changes
|
(concat-changes
|
||||||
(update-attrs shape-inst
|
(update-attrs shape-inst
|
||||||
shape-master
|
shape-master
|
||||||
|
@ -428,32 +421,39 @@
|
||||||
children-master (mapv #(cp/get-shape component %)
|
children-master (mapv #(cp/get-shape component %)
|
||||||
(:shapes shape-master))
|
(:shapes shape-master))
|
||||||
|
|
||||||
only-inst (fn [shape-inst]
|
only-inst (fn [child-inst]
|
||||||
(remove-shape shape-inst
|
(remove-shape child-inst
|
||||||
container
|
container
|
||||||
omit-touched?))
|
omit-touched?))
|
||||||
|
|
||||||
only-master (fn [shape-master]
|
only-master (fn [child-master]
|
||||||
(add-shape-to-instance shape-master
|
(add-shape-to-instance child-master
|
||||||
component
|
component
|
||||||
container
|
container
|
||||||
root-inst
|
root-inst
|
||||||
root-master
|
root-master
|
||||||
omit-touched?))
|
omit-touched?))
|
||||||
|
|
||||||
both (fn [shape-inst shape-master]
|
both (fn [child-inst child-master]
|
||||||
(let [options (if-not (:component-id shape-inst)
|
(let [sub-root? (and (:component-id shape-inst)
|
||||||
|
(not (:component-root? shape-inst)))
|
||||||
|
|
||||||
|
options (if-not sub-root?
|
||||||
options
|
options
|
||||||
{:omit-touched? true
|
{:omit-touched? true
|
||||||
:reset-touched? false
|
:reset-touched? false
|
||||||
:copy-touched? false})]
|
:copy-touched? false})]
|
||||||
|
|
||||||
(generate-sync-shape-direct-recursive container
|
(generate-sync-shape-direct-recursive container
|
||||||
shape-inst
|
child-inst
|
||||||
component
|
component
|
||||||
shape-master
|
child-master
|
||||||
root-inst
|
(if sub-root?
|
||||||
root-master
|
shape-inst
|
||||||
|
root-inst)
|
||||||
|
(if sub-root?
|
||||||
|
shape-master
|
||||||
|
root-master)
|
||||||
options)))
|
options)))
|
||||||
|
|
||||||
moved (fn [shape-inst shape-master]
|
moved (fn [shape-inst shape-master]
|
||||||
|
@ -518,14 +518,7 @@
|
||||||
:component (:name component)
|
:component (:name component)
|
||||||
:options options)
|
:options options)
|
||||||
|
|
||||||
(let [root-inst (if (:component-id shape-inst)
|
(let [component-container (cp/make-container component :component)
|
||||||
shape-inst
|
|
||||||
root-inst)
|
|
||||||
root-master (if (:component-id shape-inst)
|
|
||||||
shape-master
|
|
||||||
root-master)
|
|
||||||
|
|
||||||
component-container (cp/make-container component :component)
|
|
||||||
|
|
||||||
[rchanges uchanges]
|
[rchanges uchanges]
|
||||||
(concat-changes
|
(concat-changes
|
||||||
|
@ -549,31 +542,38 @@
|
||||||
children-master (mapv #(cp/get-shape component %)
|
children-master (mapv #(cp/get-shape component %)
|
||||||
(:shapes shape-master))
|
(:shapes shape-master))
|
||||||
|
|
||||||
only-inst (fn [shape-inst]
|
only-inst (fn [child-inst]
|
||||||
(add-shape-to-master shape-inst
|
(add-shape-to-master child-inst
|
||||||
component
|
component
|
||||||
container
|
container
|
||||||
root-inst
|
root-inst
|
||||||
root-master))
|
root-master))
|
||||||
|
|
||||||
only-master (fn [shape-master]
|
only-master (fn [child-master]
|
||||||
(remove-shape shape-master
|
(remove-shape child-master
|
||||||
component-container
|
component-container
|
||||||
false))
|
false))
|
||||||
|
|
||||||
both (fn [shape-inst shape-master]
|
both (fn [child-inst child-master]
|
||||||
(let [options (if-not (:component-id shape-inst)
|
(let [sub-root? (and (:component-id shape-inst)
|
||||||
|
(not (:component-root? shape-inst)))
|
||||||
|
|
||||||
|
options (if-not sub-root?
|
||||||
options
|
options
|
||||||
{:reset-touched? false
|
{:reset-touched? false
|
||||||
:set-touched? false
|
:set-touched? false
|
||||||
:copy-touched? true})]
|
:copy-touched? true})]
|
||||||
|
|
||||||
(generate-sync-shape-inverse-recursive container
|
(generate-sync-shape-inverse-recursive container
|
||||||
shape-inst
|
child-inst
|
||||||
component
|
component
|
||||||
shape-master
|
child-master
|
||||||
root-inst
|
(if sub-root?
|
||||||
root-master
|
shape-inst
|
||||||
|
root-inst)
|
||||||
|
(if sub-root?
|
||||||
|
shape-master
|
||||||
|
root-master)
|
||||||
options)))
|
options)))
|
||||||
|
|
||||||
moved (fn [shape-inst shape-master]
|
moved (fn [shape-inst shape-master]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue