mirror of
https://github.com/penpot/penpot.git
synced 2025-07-27 09:37:19 +02:00
🐛 Fix added children detection in fix-touched script
This commit is contained in:
parent
e9bd769823
commit
de8758c4ca
2 changed files with 11 additions and 2 deletions
|
@ -366,8 +366,8 @@
|
||||||
(let [matches? (fn [[child-id ref-child-id]]
|
(let [matches? (fn [[child-id ref-child-id]]
|
||||||
(let [child (ctn/get-shape page child-id)]
|
(let [child (ctn/get-shape page child-id)]
|
||||||
(= (:shape-ref child) ref-child-id)))
|
(= (:shape-ref child) ref-child-id)))
|
||||||
equal? (every? matches? (d/zip (:shapes shape) (:shapes ref-shape)))]
|
equal? (every? matches? (d/zip-all (:shapes shape) (:shapes ref-shape)))]
|
||||||
(when (and (not equal?) (not (cph/touched-group? shape :shapes)))
|
(when (and (not equal?) (not (cph/touched-group? shape :shapes-group)))
|
||||||
(println " -> set touched " (:name shape) (:id shape) :shapes :shapes-group))
|
(println " -> set touched " (:name shape) (:id shape) :shapes :shapes-group))
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
(and (not equal?) (not (cph/touched-group? shape :shapes-group)))
|
(and (not equal?) (not (cph/touched-group? shape :shapes-group)))
|
||||||
|
|
|
@ -256,6 +256,15 @@
|
||||||
(defn zip [col1 col2]
|
(defn zip [col1 col2]
|
||||||
(map vector col1 col2))
|
(map vector col1 col2))
|
||||||
|
|
||||||
|
(defn zip-all
|
||||||
|
"Return a zip of both collections, extended to the lenght of the longest one,
|
||||||
|
and padding the shorter one with nils as needed."
|
||||||
|
[col1 col2]
|
||||||
|
(let [diff (- (count col1) (count col2))]
|
||||||
|
(cond (pos? diff) (zip col1 (c/concat col2 (repeat nil)))
|
||||||
|
(neg? diff) (zip (c/concat col1 (repeat nil)) col2)
|
||||||
|
:else (zip col1 col2))))
|
||||||
|
|
||||||
(defn mapm
|
(defn mapm
|
||||||
"Map over the values of a map"
|
"Map over the values of a map"
|
||||||
([mfn]
|
([mfn]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue