From 0aea69948235d1f913a237568d791cc00ac1d232 Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Wed, 25 Feb 2026 15:18:18 +0100 Subject: [PATCH] :bug: Fix board title cropped using wrong side --- CHANGES.md | 1 + .../src/app/main/ui/workspace/viewport/utils.cljs | 6 ++++++ .../app/main/ui/workspace/viewport/widgets.cljs | 15 ++++++++------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 73f14701a3..e854b76ddc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -52,6 +52,7 @@ - Fix viewer can update library [Taiga #13186](https://tree.taiga.io/project/penpot/issue/13186) - Fix remove fill affects different element than selected [Taiga #13128](https://tree.taiga.io/project/penpot/issue/13128) - Fix unable to finish the create account form using keyboard [Taiga #11333](https://tree.taiga.io/project/penpot/issue/11333) +- Fix 45 rotated board titles rendered incorrectly [Taiga #13306](https://tree.taiga.io/project/penpot/issue/13306) ## 2.13.3 diff --git a/frontend/src/app/main/ui/workspace/viewport/utils.cljs b/frontend/src/app/main/ui/workspace/viewport/utils.cljs index b5d99f42f2..ca1878ae8f 100644 --- a/frontend/src/app/main/ui/workspace/viewport/utils.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/utils.cljs @@ -71,6 +71,12 @@ (> (:x cand) (:x cur)) cand :else cur))) +(defn title-transform-use-width? + [{:keys [rotation] :as shape}] + (let [side (mth/ceil (/ (- rotation 45) 90)) + use-width? (even? side)] + use-width?)) + (defn title-transform [{:keys [points] :as shape} zoom grid-edition?] (let [leftmost (->> points (reduce left?)) diff --git a/frontend/src/app/main/ui/workspace/viewport/widgets.cljs b/frontend/src/app/main/ui/workspace/viewport/widgets.cljs index f3dd84ca4e..9f1a0ab873 100644 --- a/frontend/src/app/main/ui/workspace/viewport/widgets.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/widgets.cljs @@ -129,13 +129,15 @@ (fn [_] (on-frame-leave (:id frame)))) - main-instance? (ctk/main-instance? frame) - is-variant? (:is-variant-container frame) + main-instance? (ctk/main-instance? frame) + is-variant? (:is-variant-container frame) - text-width (* (:width frame) zoom) - show-icon? (and (or (:use-for-thumbnail frame) is-grid-edition main-instance? is-variant?) - (not (<= text-width 15))) - text-pos-x (if show-icon? 15 0) + use-width? (vwu/title-transform-use-width? frame) + + text-width (* (if use-width? (:width frame) (:height frame)) zoom) + show-icon? (and (or (:use-for-thumbnail frame) is-grid-edition main-instance? is-variant?) + (not (<= text-width 15))) + text-pos-x (if show-icon? 15 0) edition* (mf/use-state false) edition? (deref edition*) @@ -178,7 +180,6 @@ (when (kbd/enter? event) (accept-edit)) (when (kbd/esc? event) (cancel-edit))))] - (when (not (:hidden frame)) [:g.frame-title {:id (dm/str "frame-title-" (:id frame)) :data-edit-grid is-grid-edition