diff --git a/frontend/src/app/main/ui/shapes/filters.cljs b/frontend/src/app/main/ui/shapes/filters.cljs index 8b5a537d1..3600042b0 100644 --- a/frontend/src/app/main/ui/shapes/filters.cljs +++ b/frontend/src/app/main/ui/shapes/filters.cljs @@ -101,12 +101,14 @@ (let [filter-bounds (->> filters - (filter #(= :drop-shadow (:type %))) + (filter #(= :drop-shadow (:style %))) (map (partial filter-bounds shape) )) - x1 (apply min (:x1 filter-bounds)) - y1 (apply min (:y1 filter-bounds)) - x2 (apply max (:x2 filter-bounds)) - y2 (apply max (:y2 filter-bounds))] + ;; We add the selrect so the minimum size will be the selrect + filter-bounds (conj filter-bounds (:selrect shape)) + x1 (apply min (map :x1 filter-bounds)) + y1 (apply min (map :y1 filter-bounds)) + x2 (apply max (map :x2 filter-bounds)) + y2 (apply max (map :y2 filter-bounds))] [x1 y1 (- x2 x1) (- y2 y1)])) (mf/defc filters diff --git a/frontend/src/app/main/ui/workspace/shapes/frame.cljs b/frontend/src/app/main/ui/workspace/shapes/frame.cljs index 1e6702795..19a47795f 100644 --- a/frontend/src/app/main/ui/workspace/shapes/frame.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/frame.cljs @@ -99,7 +99,7 @@ (fn [] (st/emit! (dws/change-hover-state (:id shape) false)))) - filter-id (filters/get-filter-id)] + filter-id (mf/use-var (filters/get-filter-id))] (when-not (:hidden shape) [:g {:class (when selected? "selected") @@ -124,8 +124,8 @@ :on-mouse-over on-mouse-over :on-mouse-out on-mouse-out} (:name shape)] - [:g.frame {:filter (filters/filter-str filter-id shape)} - [:& filters/filters {:filter-id filter-id :shape shape}] + [:g.frame {:filter (filters/filter-str @filter-id shape)} + [:& filters/filters {:filter-id @filter-id :shape shape}] [:& frame-shape {:shape shape :childs children}]]]))))) diff --git a/frontend/src/app/main/ui/workspace/shapes/path.cljs b/frontend/src/app/main/ui/workspace/shapes/path.cljs index 91389707b..5bad12bcd 100644 --- a/frontend/src/app/main/ui/workspace/shapes/path.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/path.cljs @@ -17,6 +17,7 @@ [app.main.store :as st] [app.main.ui.keyboard :as kbd] [app.main.ui.shapes.path :as path] + [app.main.ui.shapes.filters :as filters] [app.main.ui.workspace.shapes.common :as common] [app.main.data.workspace.drawing :as dr] [app.util.dom :as dom] @@ -41,10 +42,13 @@ (do (dom/stop-propagation event) (dom/prevent-default event) - (st/emit! (dw/start-edition-mode (:id shape)))))))] + (st/emit! (dw/start-edition-mode (:id shape))))))) + filter-id (mf/use-var (filters/get-filter-id))] [:g.shape {:on-double-click on-double-click :on-mouse-down on-mouse-down - :on-context-menu on-context-menu} + :on-context-menu on-context-menu + :filter (filters/filter-str @filter-id shape)} + [:& filters/filters {:filter-id @filter-id :shape shape}] [:& path/path-shape {:shape shape :background? true}]])) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/path.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/path.cljs index e3547846c..9405ff784 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/path.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/path.cljs @@ -12,7 +12,8 @@ [rumext.alpha :as mf] [app.common.data :as d] [app.main.ui.workspace.sidebar.options.fill :refer [fill-attrs fill-menu]] - [app.main.ui.workspace.sidebar.options.stroke :refer [stroke-attrs stroke-menu]])) + [app.main.ui.workspace.sidebar.options.stroke :refer [stroke-attrs stroke-menu]] + [app.main.ui.workspace.sidebar.options.shadow :refer [shadow-menu]])) (mf/defc options [{:keys [shape] :as props}] @@ -25,4 +26,7 @@ :values (select-keys shape fill-attrs)}] [:& stroke-menu {:ids ids :type type - :values stroke-values}]])) + :values stroke-values}] + [:& shadow-menu {:ids ids + :type type + :values (select-keys shape [:shadow])}]])) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/shadow.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/shadow.cljs index b3ef6ee70..dd31794a1 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/shadow.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/shadow.cljs @@ -51,8 +51,6 @@ remove-shadow-by-id (fn [values id] (->> values (filterv (fn [s] (not= (:id s) id))))) - - on-remove-shadow (fn [id] (fn []