From b999c05d1ef5299f42253fbd58a63f9ba1f60b76 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 12 Jan 2021 12:31:42 +0100 Subject: [PATCH] :sparkles: Allows change colors from root --- frontend/src/app/main/data/colors.cljs | 6 ------ .../app/main/data/workspace/selection.cljs | 20 +++++++++---------- .../ui/workspace/sidebar/options/svg_raw.cljs | 20 ++++++++----------- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/frontend/src/app/main/data/colors.cljs b/frontend/src/app/main/data/colors.cljs index 9029656ad..493e8b573 100644 --- a/frontend/src/app/main/data/colors.cljs +++ b/frontend/src/app/main/data/colors.cljs @@ -112,9 +112,6 @@ (let [pid (:current-page-id state) objects (get-in state [:workspace-data :pages-index pid :objects]) not-frame (fn [shape-id] (not= (get-in objects [shape-id :type]) :frame)) - children (->> ids (filter not-frame) (mapcat #(cp/get-children % objects))) - ids (into ids children) - is-text? #(= :text (:type (get objects %))) text-ids (filter is-text? ids) shape-ids (filter (comp not is-text?) ids) @@ -141,9 +138,6 @@ (let [pid (:current-page-id state) objects (get-in state [:workspace-data :pages-index pid :objects]) not-frame (fn [shape-id] (not= (get-in objects [shape-id :type]) :frame)) - children (->> ids (filter not-frame) (mapcat #(cp/get-children % objects))) - ids (into ids children) - update-fn (fn [s] (cond-> s true diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index adba8ac9e..64f331edb 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -226,20 +226,20 @@ objects (dwc/lookup-page-objects state page-id) find-shape (fn [selection] - (when (seq selection) - (let [id (first selection) - shape (get objects id)] - (let [child-id (->> (cp/get-children id objects) - (map #(get objects %)) - (remove (comp empty :shapes)) - (filter #(geom/has-point? % position)) - (first) - :id)] - (or child-id id)))))] + (let [id (first selection) + shape (get objects id)] + (let [child-id (->> (cp/get-children id objects) + (map #(get objects %)) + (remove (comp empty :shapes)) + (filter #(geom/has-point? % position)) + (first) + :id)] + (or child-id id))))] (->> (uw/ask! {:cmd :selection/query :page-id page-id :rect (geom/make-centered-rect position 1 1)}) (rx/first) + (rx/filter (comp not empty?)) (rx/map find-shape) (rx/filter #(not (nil? %))) (rx/map #(select-shape % false)))))))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/svg_raw.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/svg_raw.cljs index 3522b4f71..a8d559122 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/svg_raw.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/svg_raw.cljs @@ -95,22 +95,18 @@ (when (contains? svg-elements tag) [:* - (cond - (= tag :svg) + (when (= tag :svg) [:* [:& measures-menu {:ids ids :type type - :values measure-values}]] - - :else - [:* - [:& fill-menu {:ids ids - :type type - :values fill-values}] - [:& stroke-menu {:ids ids - :type type - :values stroke-values}]]) + :values measure-values}]]) + [:& fill-menu {:ids ids + :type type + :values fill-values}] + [:& stroke-menu {:ids ids + :type type + :values stroke-values}] [:& shadow-menu {:ids ids :values (select-keys shape [:shadow])}]