0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-10 14:51:37 -05:00

🐛 Fix problems with double-click and selection

This commit is contained in:
alonso.torres 2022-08-29 12:27:43 +02:00
parent 01d99222e0
commit 40130d1ca7
3 changed files with 15 additions and 14 deletions

View file

@ -2,6 +2,12 @@
## 1.15.0-beta
### :bug: Bugs fixed
- Fix problems with double-click and selection [Taiga #4005](https://tree.taiga.io/project/penpot/issue/4005)
## 1.15.0-beta
### :boom: Breaking changes & Deprecations
- The `PENPOT_LOGIN_WITH_LDAP` environment variable is finally removed (after

View file

@ -308,23 +308,18 @@
"Check if `parent-candidate` is parent of `shape-id`"
[objects shape-id parent-candidate]
(loop [current (get objects parent-candidate)
done #{}
pending (:shapes current)]
(loop [current-id shape-id]
(cond
(contains? done (:id current))
(recur (get objects (first pending))
done
(rest pending))
(= current-id parent-candidate)
true
(empty? pending) false
(and current (contains? (set (:shapes current)) shape-id)) true
(or (nil? current-id)
(= current-id uuid/zero)
(= current-id (get-in objects [current-id :parent-id])))
false
:else
(recur (get objects (first pending))
(conj done (:id current))
(concat (rest pending) (:shapes current))))))
(recur (get-in objects [current-id :parent-id])))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; COMPONENTS HELPERS

View file

@ -194,7 +194,7 @@
:else
(let [;; We only get inside childrens of the hovering shape
hover-ids (->> @hover-ids (filter (partial cph/is-child? objects id)))
selected (get objects (if (> (count hover-ids) 1) (second hover-ids) (first hover-ids)))]
selected (get objects (first hover-ids))]
(when (some? selected)
(reset! hover selected)
(st/emit! (dw/select-shape (:id selected)))))))))))))