From d8e0bab4ad12870e0c32f2a2afefec4d6e423f75 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 2 Oct 2020 12:40:22 +0200 Subject: [PATCH] :bug: Fixed problem when selecting groups --- frontend/src/app/main/data/workspace/selection.cljs | 8 +++++++- frontend/src/app/main/refs.cljs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 27b32ac5b..b642642eb 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -151,7 +151,13 @@ objects (dwc/lookup-page-objects state page-id) group (get objects group-id) children (map #(get objects %) (:shapes group)) - selected (d/seek #(geom/has-point? % position) children)] + + ;; We need to reverse the children because if two children + ;; overlap we want to select the one that's over (and it's + ;; in the later vector position + selected (->> children + reverse + (d/seek #(geom/has-point? % position)))] (when selected (rx/of deselect-all (select-shape (:id selected)))))))) diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index 6547d3c16..d16bed010 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -152,7 +152,7 @@ (defn is-child-selected? [id] (letfn [(selector [state] - (let [page-id :current-page-id + (let [page-id (:current-page-id state) objects (get-in state [:workspace-data :pages-index page-id :objects]) selected (get-in state [:workspace-local :selected]) shape (get objects id)