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/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 769f7910f1..9c5030e99c 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -92,6 +92,19 @@ (def ^:private xf:map-type (map :type)) (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* [{:keys [ids values applied-tokens type shapes]}] (let [token-numeric-inputs @@ -300,7 +313,7 @@ (mf/deps ids) (fn [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/increase-rotation ids value))) (st/emit! (udw/trigger-bounding-box-cloaking ids) diff --git a/frontend/src/app/main/ui/workspace/viewport/utils.cljs b/frontend/src/app/main/ui/workspace/viewport/utils.cljs index a4ac92b6c2..ca1878ae8f 100644 --- a/frontend/src/app/main/ui/workspace/viewport/utils.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/utils.cljs @@ -55,7 +55,7 @@ (defn top? [cur cand] - (let [closey? (mth/close? (:y cand) (:y cur))] + (let [closey? (mth/close? (:y cand) (:y cur) 0.01)] (cond (and closey? (< (:x cand) (:x cur))) cand closey? cur @@ -64,13 +64,19 @@ (defn right? [cur cand] - (let [closex? (mth/close? (:x cand) (:x cur))] + (let [closex? (mth/close? (:x cand) (:x cur) 0.01)] (cond (and closex? (< (:y cand) (:y cur))) cand closex? cur (> (: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