From 34a2a8815b5f4a90dc54ca4730e0ccf8387ee502 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 17 Jan 2025 12:30:27 +0100 Subject: [PATCH 1/3] :bug: Fix problem with alt key measures being stuck --- CHANGES.md | 2 ++ frontend/vendor/mousetrap/index.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 7033dabc8..08248554e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,8 @@ ### :bug: Bugs fixed +- Fix problem with alt key measures being stuck [Taiga #9348](https://tree.taiga.io/project/penpot/issue/9348) + ## 2.4.2 ### :bug: Bugs fixed diff --git a/frontend/vendor/mousetrap/index.js b/frontend/vendor/mousetrap/index.js index 0dd2e96b3..c1cd8af3d 100644 --- a/frontend/vendor/mousetrap/index.js +++ b/frontend/vendor/mousetrap/index.js @@ -976,6 +976,11 @@ Mousetrap.prototype.stopCallback = function (e, element, combo) { return false; } + // Keyup events need to be dispatched always. Otherwise some events can be stuck + if (e.type == 'keyup') { + return false; + } + if ('composedPath' in e && typeof e.composedPath === 'function') { // For open shadow trees, update `element` so that the following check works. const initialEventTarget = e.composedPath()[0]; @@ -990,6 +995,7 @@ Mousetrap.prototype.stopCallback = function (e, element, combo) { element.tagName == "TEXTAREA" || (element.tagName == "BUTTON" && combo.includes("tab")) || (element.contentEditable && (element.contentEditable == "true" || element.contentEditable === "plaintext-only")); + return shouldStop; } From e0281b553c6eabd38833e20e27de7dbacc179611 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 17 Jan 2025 14:31:02 +0100 Subject: [PATCH 2/3] :bug: Fix error when reseting stroke cap --- CHANGES.md | 1 + common/src/app/common/types/shape.cljc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 08248554e..0be459122 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ ### :bug: Bugs fixed - Fix problem with alt key measures being stuck [Taiga #9348](https://tree.taiga.io/project/penpot/issue/9348) +- Fix error when reseting stroke cap ## 2.4.2 diff --git a/common/src/app/common/types/shape.cljc b/common/src/app/common/types/shape.cljc index 7202a67b0..2b138a9d4 100644 --- a/common/src/app/common/types/shape.cljc +++ b/common/src/app/common/types/shape.cljc @@ -63,7 +63,7 @@ (def stroke-caps-line #{:round :square}) (def stroke-caps-marker #{:line-arrow :triangle-arrow :square-marker :circle-marker :diamond-marker}) -(def stroke-caps (set/union stroke-caps-line stroke-caps-marker)) +(def stroke-caps (conj (set/union stroke-caps-line stroke-caps-marker) nil)) (def shape-types #{:frame From 52e5978ed537c715234182e18373674fe195b2a0 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 17 Jan 2025 14:33:46 +0100 Subject: [PATCH 3/3] :bug: Fix problem with strokes not refreshing in Safari --- CHANGES.md | 1 + frontend/src/app/main/ui/shapes/custom_stroke.cljs | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0be459122..3e45b7245 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ - Fix problem with alt key measures being stuck [Taiga #9348](https://tree.taiga.io/project/penpot/issue/9348) - Fix error when reseting stroke cap +- Fix problem with strokes not refreshing in Safari [Taiga #9040](https://tree.taiga.io/project/penpot/issue/9040) ## 2.4.2 diff --git a/frontend/src/app/main/ui/shapes/custom_stroke.cljs b/frontend/src/app/main/ui/shapes/custom_stroke.cljs index 3e664412f..7168975b8 100644 --- a/frontend/src/app/main/ui/shapes/custom_stroke.cljs +++ b/frontend/src/app/main/ui/shapes/custom_stroke.cljs @@ -13,6 +13,7 @@ [app.common.geom.shapes :as gsh] [app.common.geom.shapes.bounds :as gsb] [app.common.geom.shapes.text :as gst] + [app.common.uuid :as uuid] [app.config :as cf] [app.main.ui.context :as muc] [app.main.ui.shapes.attrs :as attrs] @@ -470,12 +471,18 @@ render-id (mf/use-ctx muc/render-id) render-id (d/nilv (unchecked-get props "render-id") render-id) - stroke-id (dm/fmt "strokes-%" shape-id) + strokes (get shape :strokes) + + ;; Generate a unique id when the strokes change. This way we can solve some + ;; render issues in Safari https://tree.taiga.io/project/penpot/issue/9040 + prefix (mf/use-memo (mf/deps strokes) #(dm/str (uuid/next))) + + stroke-id (dm/str (dm/fmt "strokes-%-%" prefix shape-id)) shape-blur (get shape :blur) shape-fills (get shape :fills) shape-shadow (get shape :shadow) - shape-strokes (not-empty (get shape :strokes)) + shape-strokes (not-empty strokes) svg-attrs (attrs/get-svg-props shape render-id)