0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

Merge pull request #4248 from penpot/superalex-improve-reset-overrides-behaviour

🐛 Fix reset override behaviour
This commit is contained in:
Pablo Alba 2024-03-12 11:17:58 +01:00 committed by GitHub
commit e6964cf02c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View file

@ -708,11 +708,18 @@
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
(-> (pcb/empty-changes it)
(pcb/with-container 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
(:redo-changes changes)

View file

@ -620,7 +620,8 @@
shape-main (when component
(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)))
shape-inst (if (and reset? components-v2)

View file

@ -1177,8 +1177,8 @@
(t/is (= (:fill-opacity shape1) 0))
(t/is (= (:name shape2) "Rect 1"))
(t/is (= (:touched shape2) nil))
(t/is (= (:fill-color shape2) clr/white))
(t/is (= (:fill-opacity shape2) 1))
(t/is (= (:fill-color shape2) clr/test))
(t/is (= (:fill-opacity shape2) 0.5))
(t/is (= (:name c-instance2) "Board"))
(t/is (= (:touched c-instance2) nil))