0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix selecting children from hidden parent layers

This commit is contained in:
alonso.torres 2023-03-02 17:33:27 +01:00
parent 6962e15b6d
commit 475ce08d3e
4 changed files with 24 additions and 5 deletions

View file

@ -17,6 +17,8 @@
- Fix problem with rules position on changing pages [Taiga #4847](https://tree.taiga.io/project/penpot/issue/4847)
- Fix error streen when uploading wrong SVG [#2995](https://github.com/penpot/penpot/issues/2995)
- Fix error streen when uploading wrong SVG [#2995](https://github.com/penpot/penpot/issues/2995)
- Fix selecting children from hidden parent layers [Taiga #4934](https://tree.taiga.io/project/penpot/issue/4934)
### :arrow_up: Deps updates

View file

@ -120,6 +120,16 @@
(recur (conj result parent-id) parent-id)
result))))
(defn hidden-parent?
"Checks the parent for the hidden property"
[objects shape-id]
(let [parent-id (dm/get-in objects [shape-id :parent-id])]
(cond
(or (nil? parent-id) (nil? shape-id) (= shape-id uuid/zero) (= parent-id uuid/zero)) false
(dm/get-in objects [parent-id :hidden]) true
:else
(recur objects parent-id))))
(defn get-parent-ids-with-index
"Returns a tuple with the list of parents and a map with the position within each parent"
[objects shape-id]

View file

@ -244,6 +244,7 @@
hover-shape
(->> ids
(remove remove-id?)
(remove (partial cph/hidden-parent? objects))
(filter #(or (empty? focus) (cp/is-in-focus? objects focus %)))
(first)
(get objects))]

View file

@ -82,7 +82,9 @@
grid-y-data (get-grids-snap-points frame :y)]
(cond-> page-data
(not (ctl/any-layout-descent? objects frame))
(and (not (ctl/any-layout-descent? objects frame))
(not (:hidden frame))
(not (cph/hidden-parent? objects frame-id)))
(-> ;; Update root frame information
(assoc-in [uuid/zero :objects-data frame-id] frame-data)
@ -106,7 +108,9 @@
:id (:id shape)
:pt %)))]
(cond-> page-data
(not (ctl/any-layout-descent? objects shape))
(and (not (ctl/any-layout-descent? objects shape))
(not (:hidden shape))
(not (cph/hidden-parent? objects (:id shape))))
(-> (assoc-in [frame-id :objects-data (:id shape)] shape-data)
(update-in [frame-id :x] (make-insert-tree-data shape-data :x))
(update-in [frame-id :y] (make-insert-tree-data shape-data :y))))))
@ -124,9 +128,11 @@
:pt %)))]
(if-let [frame-id (:frame-id guide)]
;; Guide inside frame, we add the information only on that frame
(-> page-data
(assoc-in [frame-id :objects-data (:id guide)] guide-data)
(update-in [frame-id (:axis guide)] (make-insert-tree-data guide-data (:axis guide))))
(cond-> page-data
(and (not (:hidden frame))
(not (cph/hidden-parent? objects frame-id)))
(-> (assoc-in [frame-id :objects-data (:id guide)] guide-data)
(update-in [frame-id (:axis guide)] (make-insert-tree-data guide-data (:axis guide)))))
;; Guide outside the frame. We add the information in the global guides data
(-> page-data