0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 00:58:26 -05:00

Merge pull request #2200 from penpot/alotor-fix-selection

🐛 Fix problems with double-click and selection
This commit is contained in:
Pablo Alba 2022-08-29 13:45:31 +02:00 committed by GitHub
commit 1c033fd9f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)))))))))))))