From 5ed1ff6d41c619dcee6e1ded45753e0404393ae6 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 6 Feb 2024 15:36:51 +0100 Subject: [PATCH 1/4] :bug: Fix error when changing shadow color --- .../src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs index 3e82f4363..58fdad3c3 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/shadow.cljs @@ -112,7 +112,7 @@ (fn [color] (st/emit! (dch/update-shapes ids - #(assoc-in % [:shadow index :color] color))))) + #(assoc-in % [:shadow index :color] (d/without-nils color)))))) detach-color (mf/use-fn From 8032a22f14e7166e9723346d9759f151075e95d8 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 6 Feb 2024 18:34:36 +0100 Subject: [PATCH 2/4] :bug: Fix problem when moving absolute positioned shapes --- common/src/app/common/types/modifiers.cljc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/types/modifiers.cljc b/common/src/app/common/types/modifiers.cljc index 4d893118c..7967d0379 100644 --- a/common/src/app/common/types/modifiers.cljc +++ b/common/src/app/common/types/modifiers.cljc @@ -777,14 +777,19 @@ :add-children (let [value (dm/get-prop operation :value) - index (dm/get-prop operation :index)] - (if (some? index) - (update shape :shapes - (fn [shapes] - (if (vector? shapes) - (d/insert-at-index shapes index value) - (d/concat-vec shapes value)))) - (update shape :shapes d/concat-vec value))) + index (dm/get-prop operation :index) + + shape + (if (some? index) + (update shape :shapes + (fn [shapes] + (if (vector? shapes) + (d/insert-at-index shapes index value) + (d/concat-vec shapes value)))) + (update shape :shapes d/concat-vec value))] + + ;; Remove duplication + (update shape :shapes #(into [] (apply d/ordered-set %)))) :remove-children (let [value (dm/get-prop operation :value)] From 3d66ae21de42ba149f7b26952930c7618e272752 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 7 Feb 2024 11:09:54 +0100 Subject: [PATCH 3/4] :bug: Fix problem with line caps --- frontend/src/app/main/ui/shapes/attrs.cljs | 12 +++++++----- frontend/src/app/main/ui/shapes/custom_stroke.cljs | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index 200801136..43fb21123 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -90,7 +90,7 @@ attrs)) (defn add-stroke! - [attrs data render-id index] + [attrs data render-id index open-path?] (let [style (:stroke-style data :solid)] (when-not (= style :none) (let [width (:stroke-width data 1) @@ -122,16 +122,18 @@ (cond (and (contains? stroke-caps-line caps-start) (= caps-start caps-end) - (not= :inner alignment) - (not= :outer alignment) + (or open-path? + (and (not= :inner alignment) + (not= :outer alignment))) (not= :dotted style)) (obj/set! attrs "strokeLinecap" (name caps-start)) (= :dotted style) (obj/set! attrs "strokeLinecap" "round")) - (when (and (not= :inner alignment) - (not= :outer alignment)) + (when (or open-path? + (and (not= :inner alignment) + (not= :outer alignment))) ;; For other cap types we use markers. (when (or (contains? stroke-caps-marker caps-start) diff --git a/frontend/src/app/main/ui/shapes/custom_stroke.cljs b/frontend/src/app/main/ui/shapes/custom_stroke.cljs index 32dfaf9b9..6366c42e0 100644 --- a/frontend/src/app/main/ui/shapes/custom_stroke.cljs +++ b/frontend/src/app/main/ui/shapes/custom_stroke.cljs @@ -420,7 +420,7 @@ (mf/html [:> type props]))) (defn- build-stroke-element - [child value position render-id] + [child value position render-id open-path?] (let [props (obj/get child "props") type (obj/get child "type") @@ -428,7 +428,7 @@ (obj/clone) (obj/set! "fill" "none") (obj/set! "fillOpacity" "none") - (attrs/add-stroke! value render-id position)) + (attrs/add-stroke! value render-id position open-path?)) style (if (:stroke-image value) (obj/set! style "stroke" (dm/fmt "url(#stroke-fill-%-%)" render-id position)) @@ -484,9 +484,10 @@ props (mf/spread-props svg-attrs {:id stroke-id :className "strokes" - :style style})] - + :style style}) + open-path? (and ^boolean (cfh/path-shape? shape) + ^boolean (gsh/open-path? shape))] (when-not ^boolean (cfh/frame-shape? shape) (when (and (some? shape-blur) (not ^boolean (:hidden shape-blur))) @@ -503,7 +504,7 @@ :stroke value :index index :key (dm/str index "-" stroke-id)} - (build-stroke-element child value index render-id)])]))) + (build-stroke-element child value index render-id open-path?)])]))) (mf/defc shape-custom-strokes {::mf/wrap-props false} From 84537b607ecdbe7c2a8468a23c34b28600fa4595 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 7 Feb 2024 12:59:41 +0100 Subject: [PATCH 4/4] :bug: Fix problem with numeric inputs --- .../app/main/ui/components/numeric_input.cljs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/main/ui/components/numeric_input.cljs b/frontend/src/app/main/ui/components/numeric_input.cljs index 94a2636f7..b364bb23f 100644 --- a/frontend/src/app/main/ui/components/numeric_input.cljs +++ b/frontend/src/app/main/ui/components/numeric_input.cljs @@ -191,15 +191,15 @@ (mf/use-fn (mf/deps parse-value apply-value update-input on-blur) (fn [event] - (let [new-value (or @last-value* default)] - (if (or nillable? new-value) - (apply-value event new-value) - (update-input new-value))) - (when (fn? on-blur) - (on-blur event)))) + (when (mf/ref-val dirty-ref) + (let [new-value (or @last-value* default)] + (if (or nillable? new-value) + (apply-value event new-value) + (update-input new-value))) + (when (fn? on-blur) + (on-blur event))))) - handle-unmount - (h/use-ref-callback handle-blur) + handle-unmount (h/use-ref-callback handle-blur) on-click (mf/use-fn @@ -240,10 +240,7 @@ (when-let [input-node (mf/ref-val ref)] (dom/set-value! input-node (fmt/format-number value)))) - (mf/with-effect [] - (fn [] - (when (mf/ref-val dirty-ref) - (handle-unmount)))) + (mf/with-effect [handle-unmount] handle-unmount) (mf/with-layout-effect [] (let [keys [(events/listen globals/window "pointerdown" on-click)