From a9052e2690fc10e92a5bdfee830199df7640a44b Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Apr 2024 12:01:56 +0200 Subject: [PATCH 1/7] :bug: Fix problem changing fill images --- frontend/src/app/main/data/workspace/colors.cljs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/main/data/workspace/colors.cljs b/frontend/src/app/main/data/workspace/colors.cljs index 287b6c344..5e9028424 100644 --- a/frontend/src/app/main/data/workspace/colors.cljs +++ b/frontend/src/app/main/data/workspace/colors.cljs @@ -602,9 +602,11 @@ (update-in state [:stops stop] (fn [data] (->> changes (merge data) (materialize-color-components)))) + (-> state (dissoc :gradient :stops :editing-stop) - (assoc :type :color))))))) + (cond-> (not= :image (:type state)) + (assoc :type :color)))))))) ptk/WatchEvent (watch [_ state _] (when add-recent? From b7c4cb1f58261569c22cdf20d6c6f20ba0f29dea Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Apr 2024 12:03:06 +0200 Subject: [PATCH 2/7] :bug: Fix project name being cut --- frontend/src/app/main/ui/dashboard/projects.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/app/main/ui/dashboard/projects.scss b/frontend/src/app/main/ui/dashboard/projects.scss index eb73b2e89..e3b57fba5 100644 --- a/frontend/src/app/main/ui/dashboard/projects.scss +++ b/frontend/src/app/main/ui/dashboard/projects.scss @@ -85,6 +85,9 @@ line-height: 0.8; color: var(--title-foreground-color-hover); cursor: pointer; + height: $s-16; + display: inline-flex; + align-items: center; } .info-wrapper { From 27010ae0fb308d790ba66981049834e0aaadc5ab Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Apr 2024 12:03:59 +0200 Subject: [PATCH 3/7] :bug: Fix problem when moving horizontal/vertical lines --- .../main/ui/workspace/viewport/selection.cljs | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport/selection.cljs b/frontend/src/app/main/ui/workspace/viewport/selection.cljs index 8d04c1ac2..5789e2ff1 100644 --- a/frontend/src/app/main/ui/workspace/viewport/selection.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/selection.cljs @@ -36,6 +36,8 @@ (def selection-rect-width 1) (def min-selrect-side 10) (def small-selrect-side 30) +(def min-selrect-width 10) +(def min-selrect-height 10) (mf/defc selection-rect {::mf/wrap-props false} @@ -43,12 +45,27 @@ (let [x (dm/get-prop rect :x) y (dm/get-prop rect :y) width (dm/get-prop rect :width) - height (dm/get-prop rect :height)] + height (dm/get-prop rect :height) + + ;; This is a calculation to create a "minimum" interactable rect + ;; Is necesary so that small shapes in x/y (like lines) can be moved + ;; better + [x width] + (if (< width (/ min-selrect-width zoom)) + (let [width' (/ min-selrect-width zoom)] + [(- x (/ (- width' width) 2)) width']) + [x width]) + + [y height] + (if (< height (/ min-selrect-height zoom)) + (let [height' (/ min-selrect-height zoom)] + [(- y (/ (- height' height) 2)) height']) + [y height])] [:rect.main.viewport-selrect {:x x :y y - :width width - :height height + :width (max width (/ 10 zoom)) + :height (max height (/ 10 zoom)) :transform (str transform) :on-pointer-down on-move-selected :on-context-menu on-context-menu From 8f0e11d0205d6d902d9a324b7013ae4163901df8 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Apr 2024 12:05:02 +0200 Subject: [PATCH 4/7] :bug: Fix component name ellipsis --- frontend/src/app/main/ui/components/editable_label.scss | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/ui/components/editable_label.scss b/frontend/src/app/main/ui/components/editable_label.scss index 1f72eaf7a..a8c399158 100644 --- a/frontend/src/app/main/ui/components/editable_label.scss +++ b/frontend/src/app/main/ui/components/editable_label.scss @@ -20,12 +20,8 @@ color: var(--input-foreground-color-active); } -.editable-label { - display: flex; - - &.is-hidden { - display: none; - } +.editable-label.is-hidden { + display: none; } .editable-label-close { From f6c62075229c2047dfbc7bc7338a92a02199d0fa Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Apr 2024 12:07:17 +0200 Subject: [PATCH 5/7] :bug: Fix problem renaming boards from viewport --- frontend/src/app/main/data/workspace.cljs | 6 +++--- .../src/app/main/ui/workspace/sidebar/layer_name.cljs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index a6487e363..91a080b71 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -682,12 +682,12 @@ (defn end-rename-shape "End the ongoing shape rename process" - ([] (end-rename-shape nil)) - ([name] + ([] (end-rename-shape nil nil)) + ([shape-id name] (ptk/reify ::end-rename-shape ptk/WatchEvent (watch [_ state _] - (when-let [shape-id (dm/get-in state [:workspace-local :shape-for-rename])] + (when-let [shape-id (d/nilv shape-id (dm/get-in state [:workspace-local :shape-for-rename]))] (let [shape (wsh/lookup-shape state shape-id) name (str/trim name) clean-name (cfh/clean-path name) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs b/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs index 45d0a9015..43d87b40d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_name.cljs @@ -51,21 +51,21 @@ accept-edit (mf/use-fn - (mf/deps on-stop-edit) + (mf/deps shape-id on-stop-edit) (fn [] (let [name-input (mf/ref-val ref) name (str/trim (dom/get-value name-input))] (on-stop-edit) (reset! edition* false) - (st/emit! (dw/end-rename-shape name))))) + (st/emit! (dw/end-rename-shape shape-id name))))) cancel-edit (mf/use-fn - (mf/deps on-stop-edit) + (mf/deps shape-id on-stop-edit) (fn [] (on-stop-edit) (reset! edition* false) - (st/emit! (dw/end-rename-shape nil)))) + (st/emit! (dw/end-rename-shape shape-id nil)))) on-key-down (mf/use-fn From c8b2db81459cddfc0af7df67c020cc8660cff0a6 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 9 Apr 2024 18:59:17 +0200 Subject: [PATCH 6/7] :bug: Fix crash on moving a copy in a copy (for a migrated file) (2) --- common/src/app/common/types/container.cljc | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index ad2424144..b50c5058a 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -509,6 +509,7 @@ (every? nil?)))] (or ;;We don't want to change the structure of component copies + (ctk/in-component-copy? parent) (has-any-copy-parent? objects parent) ;; If we are moving something containing a main instance the container can't be part of a component (neither main nor copy) (and selected-main-instance? parent-in-component?) From 0fa2dbcaf2a267fa9e85a2cdcd945b5ead22eb83 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Apr 2024 15:30:42 +0200 Subject: [PATCH 7/7] :bug: Remove transforming flag and use a global flag --- frontend/src/app/main/data/workspace/shapes.cljs | 7 +++---- frontend/src/app/main/data/workspace/transforms.cljs | 5 ++--- frontend/src/app/main/ui/workspace/viewport/outline.cljs | 3 +-- frontend/src/app/main/ui/workspace/viewport/selection.cljs | 2 -- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 4fabc4e80..462b569c4 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -387,7 +387,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defn update-shape-flags - [ids {:keys [blocked hidden transforming undo-group] :as flags}] + [ids {:keys [blocked hidden undo-group] :as flags}] (dm/assert! "expected valid coll of uuids" (every? uuid? ids)) @@ -403,15 +403,14 @@ (fn [obj] (cond-> obj (boolean? blocked) (assoc :blocked blocked) - (boolean? hidden) (assoc :hidden hidden) - (boolean? transforming) (assoc :transforming transforming))) + (boolean? hidden) (assoc :hidden hidden))) objects (wsh/lookup-page-objects state) ;; We have change only the hidden behaviour, to hide only the ;; selected shape, block behaviour remains the same. ids (if (boolean? blocked) (into ids (->> ids (mapcat #(cfh/get-children-ids objects %)))) ids)] - (rx/of (dch/update-shapes ids update-fn {:attrs #{:blocked :hidden :transforming} :undo-group undo-group})))))) + (rx/of (dch/update-shapes ids update-fn {:attrs #{:blocked :hidden} :undo-group undo-group})))))) (defn toggle-visibility-selected [] diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 7cea9cde9..05289294d 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -28,7 +28,6 @@ [app.main.data.workspace.collapse :as dwc] [app.main.data.workspace.modifiers :as dwm] [app.main.data.workspace.selection :as dws] - [app.main.data.workspace.shapes :as dwsh] [app.main.data.workspace.state-helpers :as wsh] [app.main.data.workspace.undo :as dwu] [app.main.snap :as snap] @@ -291,10 +290,10 @@ ptk/WatchEvent (watch [_ _ stream] (rx/concat - (rx/of (dwsh/update-shape-flags ids {:transforming true})) + (rx/of #(assoc-in % [:workspace-local :transform] :move)) (->> (rx/timer 1000) (rx/map (fn [] - (dwsh/update-shape-flags ids {:transforming false}))) + #(assoc-in % [:workspace-local :transform] nil))) (rx/take-until (rx/filter (ptk/type? ::trigger-bounding-box-cloaking) stream))))))) diff --git a/frontend/src/app/main/ui/workspace/viewport/outline.cljs b/frontend/src/app/main/ui/workspace/viewport/outline.cljs index 176128102..3cd2b3a95 100644 --- a/frontend/src/app/main/ui/workspace/viewport/outline.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/outline.cljs @@ -113,8 +113,7 @@ (defn- show-outline? [shape] (and (not (:hidden shape)) - (not (:blocked shape)) - (not (:transforming shape)))) + (not (:blocked shape)))) (mf/defc shape-outlines {::mf/wrap-props false} diff --git a/frontend/src/app/main/ui/workspace/viewport/selection.cljs b/frontend/src/app/main/ui/workspace/viewport/selection.cljs index 5789e2ff1..be2466409 100644 --- a/frontend/src/app/main/ui/workspace/viewport/selection.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/selection.cljs @@ -321,7 +321,6 @@ transform (gsh/transform-str shape)] (when (and (some? selrect) - (not (:transforming shape)) (not (or (= transform-type :move) (= transform-type :rotate)))) [:g.controls {:pointer-events (if ^boolean disable-handlers "none" "visible")} @@ -356,7 +355,6 @@ (and flip-y (not flip-x)))] (when (and (not ^boolean read-only?) - (not (:transforming shape)) (not (or (= transform-type :move) (= transform-type :rotate))))