mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 14:51:40 +02:00
Merge pull request #4248 from penpot/superalex-improve-reset-overrides-behaviour
🐛 Fix reset override behaviour
This commit is contained in:
commit
e6964cf02c
3 changed files with 12 additions and 4 deletions
|
@ -708,11 +708,18 @@
|
||||||
components-v2
|
components-v2
|
||||||
(features/active-feature? state "components/v2")
|
(features/active-feature? state "components/v2")
|
||||||
|
|
||||||
|
shape-inst (ctn/get-shape container id)
|
||||||
|
swap-slot (-> (ctn/get-shape container id)
|
||||||
|
(ctk/get-swap-slot))
|
||||||
changes
|
changes
|
||||||
(-> (pcb/empty-changes it)
|
(-> (pcb/empty-changes it)
|
||||||
(pcb/with-container container)
|
(pcb/with-container container)
|
||||||
(pcb/with-objects (:objects container))
|
(pcb/with-objects (:objects container))
|
||||||
(dwlh/generate-sync-shape-direct file-full libraries container id true components-v2))]
|
(dwlh/generate-sync-shape-direct file-full libraries container id true components-v2)
|
||||||
|
(cond->
|
||||||
|
(some? swap-slot)
|
||||||
|
;; We need to propagate parent changes
|
||||||
|
(dwlh/generate-sync-shape-direct file-full libraries container (:parent-id shape-inst) true components-v2)))]
|
||||||
|
|
||||||
(log/debug :msg "RESET-COMPONENT finished" :js/rchanges (log-changes
|
(log/debug :msg "RESET-COMPONENT finished" :js/rchanges (log-changes
|
||||||
(:redo-changes changes)
|
(:redo-changes changes)
|
||||||
|
|
|
@ -620,7 +620,8 @@
|
||||||
|
|
||||||
shape-main (when component
|
shape-main (when component
|
||||||
(if (and reset? components-v2)
|
(if (and reset? components-v2)
|
||||||
(ctf/find-remote-shape container libraries shape-inst)
|
;; the reset is against the ref-shape, not against the original shape of the component
|
||||||
|
(ctf/find-ref-shape file container libraries shape-inst)
|
||||||
(ctf/get-ref-shape library component shape-inst)))
|
(ctf/get-ref-shape library component shape-inst)))
|
||||||
|
|
||||||
shape-inst (if (and reset? components-v2)
|
shape-inst (if (and reset? components-v2)
|
||||||
|
|
|
@ -1177,8 +1177,8 @@
|
||||||
(t/is (= (:fill-opacity shape1) 0))
|
(t/is (= (:fill-opacity shape1) 0))
|
||||||
(t/is (= (:name shape2) "Rect 1"))
|
(t/is (= (:name shape2) "Rect 1"))
|
||||||
(t/is (= (:touched shape2) nil))
|
(t/is (= (:touched shape2) nil))
|
||||||
(t/is (= (:fill-color shape2) clr/white))
|
(t/is (= (:fill-color shape2) clr/test))
|
||||||
(t/is (= (:fill-opacity shape2) 1))
|
(t/is (= (:fill-opacity shape2) 0.5))
|
||||||
|
|
||||||
(t/is (= (:name c-instance2) "Board"))
|
(t/is (= (:name c-instance2) "Board"))
|
||||||
(t/is (= (:touched c-instance2) nil))
|
(t/is (= (:touched c-instance2) nil))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue