0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-31 09:01:20 -05:00

🐛 Fix problem editing rotated texts

This commit is contained in:
alonso.torres 2022-09-01 12:44:33 +02:00
parent d6317297d7
commit 04d6e76c6c
4 changed files with 43 additions and 25 deletions

View file

@ -4,8 +4,9 @@
### :bug: Bugs fixed
- Fix error when moving nested frames outside [Taiga #4017] https://tree.taiga.io/project/penpot/issue/4017
- Fix problem when hovering over nested frames [Taiga #4018] https://tree.taiga.io/project/penpot/issue/4018
- Fix error when moving nested frames outside [Taiga #4017](https://tree.taiga.io/project/penpot/issue/4017)
- Fix problem when hovering over nested frames [Taiga #4018](https://tree.taiga.io/project/penpot/issue/4018)
- Fix problem editing rotated texts [Taiga #4026](https://tree.taiga.io/project/penpot/issue/4026)
## 1.15.2-beta

View file

@ -17,16 +17,22 @@
:width width
:height height})
(defn position-data-points
[{:keys [position-data] :as shape}]
(let [points (->> position-data
(mapcat (comp gpr/rect->points position-data->rect)))
transform (gtr/transform-matrix shape)]
(gco/transform-points points transform)))
(defn position-data-selrect
[shape]
(let [points (->> shape
:position-data
(mapcat (comp gpr/rect->points position-data->rect)))]
(-> points (gpr/points->selrect))))
(defn position-data-bounding-box
[shape]
(gpr/points->selrect (position-data-points shape)))
(let [points (->> shape
:position-data
(mapcat (comp gpr/rect->points position-data->rect)))
transform (gtr/transform-matrix shape)]
(-> points
(gco/transform-points transform)
(gpr/points->selrect ))))
(defn overlaps-position-data?
"Checks if the given position data is inside the shape"

View file

@ -8,6 +8,8 @@
(:require
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.geom.shapes :as gsh]
[app.common.geom.shapes.text :as gsht]
[app.common.math :as mth]
[app.main.data.workspace.texts :as dwt]
[app.main.refs :as refs]
@ -37,19 +39,28 @@
[:& text/text-shape {:shape shape}]]
(when (and (debug? :text-outline) (d/not-empty? (:position-data shape)))
(for [[index data] (d/enumerate (:position-data shape))]
(let [{:keys [x y width height]} data]
[:g {:key (dm/str index)}
;; Text fragment bounding box
[:rect {:x x
:y (- y height)
:width width
:height height
:style {:fill "none" :stroke "red"}}]
[:g {:transform (gsh/transform-str shape {:no-flip true})}
(let [bounding-box (gsht/position-data-selrect shape)]
[:rect {
:x (:x bounding-box)
:y (:y bounding-box)
:width (:width bounding-box)
:height (:height bounding-box)
:style { :fill "none" :stroke "orange"}}])
;; Text baselineazo
[:line {:x1 (mth/round x)
:y1 (mth/round (- (:y data) (:height data)))
:x2 (mth/round (+ x width))
:y2 (mth/round (- (:y data) (:height data)))
:style {:stroke "blue"}}]])))]))
(for [[index data] (d/enumerate (:position-data shape))]
(let [{:keys [x y width height]} data]
[:g {:key (dm/str index)}
;; Text fragment bounding box
[:rect {:x x
:y (- y height)
:width width
:height height
:style {:fill "none" :stroke "red"}}]
;; Text baselineazo
[:line {:x1 (mth/round x)
:y1 (mth/round (- (:y data) (:height data)))
:x2 (mth/round (+ x width))
:y2 (mth/round (- (:y data) (:height data)))
:style {:stroke "blue"}}]]))])]))

View file

@ -272,7 +272,7 @@
(some? text-modifier)
(dwt/apply-text-modifier text-modifier))
bounding-box (gsht/position-data-bounding-box shape)
bounding-box (gsht/position-data-selrect shape)
x (min (:x bounding-box) (:x shape))
y (min (:y bounding-box) (:y shape))