From 570f03806245665a70a8fc44ddee294cc19e8a73 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 13 May 2022 16:03:06 +0200 Subject: [PATCH] :bug: Disable stroke style for texts --- .../sidebar/options/menus/stroke.cljs | 5 +++-- .../sidebar/options/rows/stroke_row.cljs | 19 ++++++++++--------- .../sidebar/options/shapes/multiple.cljs | 5 ++++- .../sidebar/options/shapes/text.cljs | 3 ++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs index e18ad8832..a7c0e619c 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/stroke.cljs @@ -34,7 +34,7 @@ (mf/defc stroke-menu {::mf/wrap [#(mf/memo' % (mf/check-props ["ids" "values" "type" "show-caps"]))]} - [{:keys [ids type values show-caps] :as props}] + [{:keys [ids type values show-caps disable-stroke-style] :as props}] (let [label (case type :multiple (tr "workspace.options.selection-stroke") :group (tr "workspace.options.group-stroke") @@ -191,4 +191,5 @@ :on-reorder (handle-reorder index) :disable-drag disable-drag :select-all select-all - :on-blur on-blur}])])]])) + :on-blur on-blur + :disable-stroke-style disable-stroke-style}])])]])) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/rows/stroke_row.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/rows/stroke_row.cljs index c27501057..449ac8235 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/rows/stroke_row.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/rows/stroke_row.cljs @@ -47,7 +47,7 @@ (second)))) (mf/defc stroke-row - [{:keys [index stroke title show-caps on-color-change on-reorder on-color-detach on-remove on-stroke-width-change on-stroke-style-change on-stroke-alignment-change open-caps-select close-caps-select on-stroke-cap-start-change on-stroke-cap-end-change on-stroke-cap-switch disable-drag select-all on-blur]}] + [{:keys [index stroke title show-caps on-color-change on-reorder on-color-detach on-remove on-stroke-width-change on-stroke-style-change on-stroke-alignment-change open-caps-select close-caps-select on-stroke-cap-start-change on-stroke-cap-end-change on-stroke-cap-switch disable-drag select-all on-blur disable-stroke-style]}] (let [start-caps-state (mf/use-state {:open? false :top 0 :left 0}) @@ -110,14 +110,15 @@ [:option {:value ":inner"} (tr "workspace.options.stroke.inner")] [:option {:value ":outer"} (tr "workspace.options.stroke.outer")]] - [:select#style.input-select {:value (enum->string (:stroke-style stroke)) - :on-change (on-stroke-style-change index)} - (when (= (:stroke-style stroke) :multiple) - [:option {:value ""} "--"]) - [:option {:value ":solid"} (tr "workspace.options.stroke.solid")] - [:option {:value ":dotted"} (tr "workspace.options.stroke.dotted")] - [:option {:value ":dashed"} (tr "workspace.options.stroke.dashed")] - [:option {:value ":mixed"} (tr "workspace.options.stroke.mixed")]]] + (when-not disable-stroke-style + [:select#style.input-select {:value (enum->string (:stroke-style stroke)) + :on-change (on-stroke-style-change index)} + (when (= (:stroke-style stroke) :multiple) + [:option {:value ""} "--"]) + [:option {:value ":solid"} (tr "workspace.options.stroke.solid")] + [:option {:value ":dotted"} (tr "workspace.options.stroke.dotted")] + [:option {:value ":dashed"} (tr "workspace.options.stroke.dashed")] + [:option {:value ":mixed"} (tr "workspace.options.stroke.mixed")]])] ;; Stroke Caps (when show-caps diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs index 7b4754e02..d962787e1 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/multiple.cljs @@ -240,6 +240,8 @@ type :multiple all-types (into #{} (map :type shapes)) + has-text? (contains? all-types :text) + [measure-ids measure-values] (get-attrs shapes objects :measure) [layer-ids layer-values @@ -279,7 +281,8 @@ [:& fill-menu {:type type :ids fill-ids :values fill-values}]) (when-not (empty? stroke-ids) - [:& stroke-menu {:type type :ids stroke-ids :show-caps show-caps :values stroke-values}]) + [:& stroke-menu {:type type :ids stroke-ids :show-caps show-caps :values stroke-values + :disable-stroke-style has-text?}]) (when-not (empty? shadow-ids) [:& shadow-menu {:type type :ids shadow-ids :values shadow-values}]) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs index 93324181a..62ab34475 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/text.cljs @@ -80,7 +80,8 @@ [:& stroke-menu {:ids ids :type type - :values stroke-values}] + :values stroke-values + :disable-stroke-style true}] [:& shadow-menu {:ids ids