From 217ca6672021f21df1c7f9de051560ced6d31d60 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 14 Jul 2023 09:54:26 +0200 Subject: [PATCH 1/7] :bug: Fix position of text cursor is a bit too high in Invitations section --- CHANGES.md | 1 + frontend/resources/styles/main/partials/dashboard-team.scss | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index be9ac3a18c..13bc3d0763 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -80,6 +80,7 @@ - Fix create typography with section closed [Taiga #5574](https://tree.taiga.io/project/penpot/issue/5574) - Fix exports menu on viewer mode [Taiga #5568](https://tree.taiga.io/project/penpot/issue/5568) - Fix create empty comments [Taiga #5536](https://tree.taiga.io/project/penpot/issue/5536) +- Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511) ### :arrow_up: Deps updates diff --git a/frontend/resources/styles/main/partials/dashboard-team.scss b/frontend/resources/styles/main/partials/dashboard-team.scss index 45ee9d6ecb..5bdfcebda5 100644 --- a/frontend/resources/styles/main/partials/dashboard-team.scss +++ b/frontend/resources/styles/main/partials/dashboard-team.scss @@ -35,6 +35,7 @@ input { &.no-padding { padding-top: 12px; + height: 50px; } min-height: 40px; } From 203b6c63a4dce157a3dc0ec886eb5f90729fede3 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 14 Jul 2023 09:22:08 +0200 Subject: [PATCH 2/7] :bug: Fix incorrect style for asset libraries titles --- frontend/resources/styles/main/partials/sidebar.scss | 9 +++++++++ frontend/src/app/main/ui/workspace/sidebar/assets.cljs | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/resources/styles/main/partials/sidebar.scss b/frontend/resources/styles/main/partials/sidebar.scss index d8498fa7b3..b1890d5ec9 100644 --- a/frontend/resources/styles/main/partials/sidebar.scss +++ b/frontend/resources/styles/main/partials/sidebar.scss @@ -85,6 +85,15 @@ } } + span.library-title { + color: $color-gray-10; + font-size: $fs14; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .tool-window-bar-icon { height: 21px; display: flex; diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 8b8e666657..627a0861b5 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -2100,11 +2100,11 @@ (if local? [:* - [:span file-name " (" (tr "workspace.assets.local-library") ")"] + [:span.library-title file-name " (" (tr "workspace.assets.local-library") ")"] (when shared? [:span.tool-badge (tr "workspace.assets.shared")])] [:* - [:span file-name] + [:span.library-title file-name] [:span.tool-link.tooltip.tooltip-left {:alt "Open library file"} [:a {:href (str "#" url) :target "_blank" From 9b9f2c39b96d0425b5645bb229c9917c83596346 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 14 Jul 2023 08:47:34 +0200 Subject: [PATCH 3/7] :bug: Fix duplicate a component copy missing shape-ref --- .../app/main/data/workspace/selection.cljs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 9bab204bf7..efffe23655 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -397,9 +397,9 @@ (defn- prepare-duplicate-shape-change ([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id] - (prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj))) + (prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj) false)) - ([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id] + ([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id duplicating-component?] (cond (nil? obj) changes @@ -413,8 +413,9 @@ parent-id (or parent-id frame-id) name (:name obj) - is-component-root? (:saved-component-root? obj) - is-component-main? (:main-instance? obj) + is-component-root? (or (:saved-component-root? obj) (ctk/instance-root? obj)) + duplicating-component? (or duplicating-component? is-component-root?) + is-component-main? (ctk/main-instance? obj) regenerate-component (fn [changes shape] (let [components-v2 (dm/get-in library-data [:options :components-v2]) @@ -428,12 +429,15 @@ :frame-id frame-id) (dissoc :shapes :main-instance? - :shape-ref :use-for-thumbnail?) (gsh/move delta) (d/update-when :interactions #(ctsi/remap-interactions % ids-map objects))) - changes (-> (pcb/add-object changes new-obj) + new-obj (cond-> new-obj + (not duplicating-component?) + (dissoc :shape-ref)) + + changes (-> (pcb/add-object changes new-obj {:ignore-touched duplicating-component?}) (pcb/amend-last-change #(assoc % :old-id (:id obj)))) changes (cond-> changes @@ -454,7 +458,8 @@ it file-id (if frame? new-id frame-id) - new-id)) + new-id + duplicating-component?)) changes (map (d/getf objects) (:shapes obj))))))) From 53b4c6383b1deaac27f0e3c53870af8ab0e1f342 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 12 Jul 2023 12:56:50 +0200 Subject: [PATCH 4/7] :bug: Fix undo when updating several texts --- CHANGES.md | 1 + frontend/src/app/main/data/workspace/texts.cljs | 12 ++++++++++++ .../ui/workspace/sidebar/options/menus/text.cljs | 15 ++++++++------- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 13bc3d0763..ba3ac7d278 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -81,6 +81,7 @@ - Fix exports menu on viewer mode [Taiga #5568](https://tree.taiga.io/project/penpot/issue/5568) - Fix create empty comments [Taiga #5536](https://tree.taiga.io/project/penpot/issue/5536) - Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511) +- Fix undo when updating several texts [Taiga #5197](https://tree.taiga.io/project/penpot/issue/5197) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index eea3ec6c81..2f002f7c94 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -627,6 +627,18 @@ (rx/of (update-text-attrs {:id id :attrs attrs})) (rx/empty))))))) +(defn update-all-attrs + [ids attrs] + (ptk/reify ::update-all-attrs + ptk/WatchEvent + (watch [_ _ _] + (let [undo-id (js/Symbol)] + (rx/concat + (rx/of (dwu/start-undo-transaction undo-id)) + (->> (rx/from ids) + (rx/map #(update-attrs % attrs))) + (rx/of (dwu/commit-undo-transaction undo-id))))))) + (defn apply-typography "A higher level event that has the resposability of to apply the diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs index e373bb79af..a7f85fe0ff 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs @@ -172,16 +172,16 @@ emit-update! (mf/use-callback (mf/deps values) - (fn [id attrs] - (st/emit! (dwt/save-font (-> (merge txt/default-text-attrs values attrs) - (select-keys dwt/text-attrs))) - (dwt/update-attrs id attrs)))) + (fn [ids attrs] + (st/emit! (dwt/save-font (-> (merge txt/default-text-attrs values attrs) + (select-keys dwt/text-attrs))) + (dwt/update-all-attrs ids attrs)))) on-change (mf/use-callback (mf/deps ids emit-update!) (fn [attrs] - (run! #(emit-update! % attrs) ids))) + (emit-update! ids attrs))) typography (mf/use-memo @@ -211,8 +211,9 @@ typography (dwt/generate-typography-name typography) id (uuid/next)] (st/emit! (dwl/add-typography (assoc typography :id id) false)) - (run! #(emit-update! % {:typography-ref-id id - :typography-ref-file file-id}) ids))) + (emit-update! ids + {:typography-ref-id id + :typography-ref-file file-id}))) handle-detach-typography (mf/use-callback From b1f0d095018827d8928e319659dbe3359bdb205f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 12 Jul 2023 13:36:28 +0200 Subject: [PATCH 5/7] :bug: Fix assets right click button for multiple selection --- CHANGES.md | 1 + frontend/src/app/main/ui/workspace/sidebar/assets.cljs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ba3ac7d278..569d5dde3b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -82,6 +82,7 @@ - Fix create empty comments [Taiga #5536](https://tree.taiga.io/project/penpot/issue/5536) - Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511) - Fix undo when updating several texts [Taiga #5197](https://tree.taiga.io/project/penpot/issue/5197) +- Fix assets right click button for multiple selection [Taiga #5545](https://tree.taiga.io/project/penpot/issue/5545) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 8b8e666657..956c60eedc 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -451,7 +451,7 @@ on-context-menu (mf/use-fn - (mf/deps component-id) + (mf/deps on-context-menu component-id) (partial on-context-menu component-id))] [:div {:ref item-ref @@ -873,7 +873,7 @@ on-context-menu (mf/use-fn - (mf/deps object-id) + (mf/deps on-context-menu object-id) (partial on-context-menu object-id)) on-asset-click From c670089c03a00dcd4ed177c005efe28004a3bd85 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 13 Jul 2023 11:35:13 +0200 Subject: [PATCH 6/7] :bug: Fix problem with skew transformations --- CHANGES.md | 1 + common/src/app/common/geom/shapes.cljc | 1 + common/src/app/common/geom/shapes/common.cljc | 12 ++++++++++++ common/src/app/common/geom/shapes/modifiers.cljc | 2 +- .../src/app/common/geom/shapes/pixel_precision.cljc | 2 +- common/src/app/common/geom/shapes/transforms.cljc | 2 +- 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 569d5dde3b..5ef076825a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -83,6 +83,7 @@ - Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511) - Fix undo when updating several texts [Taiga #5197](https://tree.taiga.io/project/penpot/issue/5197) - Fix assets right click button for multiple selection [Taiga #5545](https://tree.taiga.io/project/penpot/issue/5545) +- Fix problem with precision in resizes [Taiga #5623](https://tree.taiga.io/project/penpot/issue/5623) ### :arrow_up: Deps updates diff --git a/common/src/app/common/geom/shapes.cljc b/common/src/app/common/geom/shapes.cljc index fabefe36b1..9c2e99dcb0 100644 --- a/common/src/app/common/geom/shapes.cljc +++ b/common/src/app/common/geom/shapes.cljc @@ -136,6 +136,7 @@ (dm/export gco/center-rect) (dm/export gco/center-points) (dm/export gco/transform-points) +(dm/export gco/shape->points) (dm/export gpr/make-rect) (dm/export gpr/make-selrect) diff --git a/common/src/app/common/geom/shapes/common.cljc b/common/src/app/common/geom/shapes/common.cljc index a0fcdb4b5d..bb4d573564 100644 --- a/common/src/app/common/geom/shapes/common.cljc +++ b/common/src/app/common/geom/shapes/common.cljc @@ -84,3 +84,15 @@ (or (mth/nan? (:x p)) (mth/nan? (:y p)))) points))) + +(defn shape->points + [{:keys [transform points]}] + (if (gmt/unit? transform) + ;; Fix problem with precision could skew the shape + ;; when there are no transforms the points are the selrect shape + (let [p0 (nth points 0) ;; left top + p2 (nth points 2) ;; right bottom + p1 (gpt/point (:x p2) (:y p0)) + p3 (gpt/point (:x p0) (:y p2))] + [p0 p1 p2 p3]) + points)) diff --git a/common/src/app/common/geom/shapes/modifiers.cljc b/common/src/app/common/geom/shapes/modifiers.cljc index 14ffa6ddf5..fb033a49b0 100644 --- a/common/src/app/common/geom/shapes/modifiers.cljc +++ b/common/src/app/common/geom/shapes/modifiers.cljc @@ -463,7 +463,7 @@ (cond-> modif-tree snap-pixel? (gpp/adjust-pixel-precision objects snap-precision snap-ignore-axis)) - bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points])) + bounds (d/lazy-map (keys objects) #(gco/shape->points (get objects %))) bounds (cond-> bounds (some? old-modif-tree) (transform-bounds objects old-modif-tree)) diff --git a/common/src/app/common/geom/shapes/pixel_precision.cljc b/common/src/app/common/geom/shapes/pixel_precision.cljc index 9994b09788..3402465018 100644 --- a/common/src/app/common/geom/shapes/pixel_precision.cljc +++ b/common/src/app/common/geom/shapes/pixel_precision.cljc @@ -58,7 +58,7 @@ (defn set-pixel-precision "Adjust modifiers so they adjust to the pixel grid" [modifiers shape precision ignore-axis] - (let [points (-> shape :points (gco/transform-points (ctm/modifiers->transform modifiers))) + (let [points (-> shape gco/shape->points (gco/transform-points (ctm/modifiers->transform modifiers))) has-resize? (not (ctm/only-move? modifiers)) [modifiers points] diff --git a/common/src/app/common/geom/shapes/transforms.cljc b/common/src/app/common/geom/shapes/transforms.cljc index 1c7bc9b8ea..90bddd81e9 100644 --- a/common/src/app/common/geom/shapes/transforms.cljc +++ b/common/src/app/common/geom/shapes/transforms.cljc @@ -317,7 +317,7 @@ its properties. We adjust de x,y,width,height and create a custom transform" [shape transform-mtx] - (let [points' (:points shape) + (let [points' (gco/shape->points shape) points (gco/transform-points points' transform-mtx) shape (-> shape (adjust-shape-flips points)) bool? (= (:type shape) :bool) From 0f60f115f5f3c5b017fcc69fa927e8cbc8b8a403 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 14 Jul 2023 14:10:26 +0200 Subject: [PATCH 7/7] :bug: Fix focus list for texts --- .../app/main/ui/workspace/shapes/text/editor.cljs | 12 +++++++----- frontend/src/app/util/text_editor.cljs | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs index 64805ef19e..52afa3514b 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs @@ -131,11 +131,13 @@ (mf/use-callback (mf/deps shape state) (fn [event] - (dom/stop-propagation event) - (dom/prevent-default event) - (st/emit! ::dwt/finalize-editor-state) - (st/emit! (dwt/initialize-editor-state shape default-decorator)) - (reset! blurred true))) + (let [is-empty? (ted/is-current-empty state)] + (dom/stop-propagation event) + (dom/prevent-default event) + (when (not is-empty?) + (st/emit! ::dwt/finalize-editor-state) + (st/emit! (dwt/initialize-editor-state shape default-decorator))) + (reset! blurred true)))) on-focus (mf/use-callback diff --git a/frontend/src/app/util/text_editor.cljs b/frontend/src/app/util/text_editor.cljs index 42708f63f4..a6cedcce8a 100644 --- a/frontend/src/app/util/text_editor.cljs +++ b/frontend/src/app/util/text_editor.cljs @@ -73,6 +73,10 @@ (let [block (impl/getCurrentBlock state)] (get-editor-block-data block))) +(defn is-current-empty + [state] + (impl/isCurrentEmpty state)) + (defn get-editor-current-inline-styles [state] (if (impl/isCurrentEmpty state)