Merge pull request #8403 from penpot/azazeln28-issue-13306-45-degree-rotated-board

🐛 Fix 45 rotated board doesn't show title properly
This commit is contained in:
Alejandro Alonso 2026-02-26 07:57:12 +01:00 committed by GitHub
commit 901aa9bf09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 10 deletions

View File

@ -52,6 +52,7 @@
- Fix viewer can update library [Taiga #13186](https://tree.taiga.io/project/penpot/issue/13186) - 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 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 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 ## 2.13.3

View File

@ -92,6 +92,19 @@
(def ^:private xf:map-type (map :type)) (def ^:private xf:map-type (map :type))
(def ^:private xf:mapcat-type-to-options (mapcat type->options)) (def ^:private xf:mapcat-type-to-options (mapcat type->options))
(defn fixed-decimal-value
"Fixes the amount of decimals that are kept"
([value]
(fixed-decimal-value value 2))
([value decimals]
(cond
(string? value)
(fixed-decimal-value (parse-double value) decimals)
(number? value)
(parse-double (.toFixed value decimals)))))
(mf/defc measures-menu* (mf/defc measures-menu*
[{:keys [ids values applied-tokens type shapes]}] [{:keys [ids values applied-tokens type shapes]}]
(let [token-numeric-inputs (let [token-numeric-inputs
@ -300,7 +313,7 @@
(mf/deps ids) (mf/deps ids)
(fn [value] (fn [value]
(if (or (string? value) (number? value)) (if (or (string? value) (number? value))
(do (let [value (fixed-decimal-value value)]
(st/emit! (udw/trigger-bounding-box-cloaking ids)) (st/emit! (udw/trigger-bounding-box-cloaking ids))
(st/emit! (udw/increase-rotation ids value))) (st/emit! (udw/increase-rotation ids value)))
(st/emit! (udw/trigger-bounding-box-cloaking ids) (st/emit! (udw/trigger-bounding-box-cloaking ids)

View File

@ -55,7 +55,7 @@
(defn top? (defn top?
[cur cand] [cur cand]
(let [closey? (mth/close? (:y cand) (:y cur))] (let [closey? (mth/close? (:y cand) (:y cur) 0.01)]
(cond (cond
(and closey? (< (:x cand) (:x cur))) cand (and closey? (< (:x cand) (:x cur))) cand
closey? cur closey? cur
@ -64,13 +64,19 @@
(defn right? (defn right?
[cur cand] [cur cand]
(let [closex? (mth/close? (:x cand) (:x cur))] (let [closex? (mth/close? (:x cand) (:x cur) 0.01)]
(cond (cond
(and closex? (< (:y cand) (:y cur))) cand (and closex? (< (:y cand) (:y cur))) cand
closex? cur closex? cur
(> (:x cand) (:x cur)) cand (> (:x cand) (:x cur)) cand
:else cur))) :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 (defn title-transform
[{:keys [points] :as shape} zoom grid-edition?] [{:keys [points] :as shape} zoom grid-edition?]
(let [leftmost (->> points (reduce left?)) (let [leftmost (->> points (reduce left?))

View File

@ -129,13 +129,15 @@
(fn [_] (fn [_]
(on-frame-leave (:id frame)))) (on-frame-leave (:id frame))))
main-instance? (ctk/main-instance? frame) main-instance? (ctk/main-instance? frame)
is-variant? (:is-variant-container frame) is-variant? (:is-variant-container frame)
text-width (* (:width frame) zoom) use-width? (vwu/title-transform-use-width? frame)
show-icon? (and (or (:use-for-thumbnail frame) is-grid-edition main-instance? is-variant?)
(not (<= text-width 15))) text-width (* (if use-width? (:width frame) (:height frame)) zoom)
text-pos-x (if show-icon? 15 0) 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* (mf/use-state false)
edition? (deref edition*) edition? (deref edition*)
@ -178,7 +180,6 @@
(when (kbd/enter? event) (accept-edit)) (when (kbd/enter? event) (accept-edit))
(when (kbd/esc? event) (cancel-edit))))] (when (kbd/esc? event) (cancel-edit))))]
(when (not (:hidden frame)) (when (not (:hidden frame))
[:g.frame-title {:id (dm/str "frame-title-" (:id frame)) [:g.frame-title {:id (dm/str "frame-title-" (:id frame))
:data-edit-grid is-grid-edition :data-edit-grid is-grid-edition