diff --git a/CHANGES.md b/CHANGES.md index c4cd604ba..b09e6aba9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/common/src/app/common/pages/helpers.cljc b/common/src/app/common/pages/helpers.cljc index 3f5ef1ce4..c7214af10 100644 --- a/common/src/app/common/pages/helpers.cljc +++ b/common/src/app/common/pages/helpers.cljc @@ -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 diff --git a/frontend/src/app/main/ui/workspace/viewport/actions.cljs b/frontend/src/app/main/ui/workspace/viewport/actions.cljs index c7e8b1eb4..2a75401ad 100644 --- a/frontend/src/app/main/ui/workspace/viewport/actions.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/actions.cljs @@ -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)))))))))))))