0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-10 06:41:40 -05:00

🐛 Fix problem with skew transformations

This commit is contained in:
alonso.torres 2023-07-13 11:35:13 +02:00 committed by Andrés Moya
parent b1f0d09501
commit c670089c03
6 changed files with 17 additions and 3 deletions

View file

@ -83,6 +83,7 @@
- Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511)
- Fix undo when updating several texts [Taiga #5197](https://tree.taiga.io/project/penpot/issue/5197)
- Fix assets right click button for multiple selection [Taiga #5545](https://tree.taiga.io/project/penpot/issue/5545)
- Fix problem with precision in resizes [Taiga #5623](https://tree.taiga.io/project/penpot/issue/5623)
### :arrow_up: Deps updates

View file

@ -136,6 +136,7 @@
(dm/export gco/center-rect)
(dm/export gco/center-points)
(dm/export gco/transform-points)
(dm/export gco/shape->points)
(dm/export gpr/make-rect)
(dm/export gpr/make-selrect)

View file

@ -84,3 +84,15 @@
(or (mth/nan? (:x p))
(mth/nan? (:y p))))
points)))
(defn shape->points
[{:keys [transform points]}]
(if (gmt/unit? transform)
;; Fix problem with precision could skew the shape
;; when there are no transforms the points are the selrect shape
(let [p0 (nth points 0) ;; left top
p2 (nth points 2) ;; right bottom
p1 (gpt/point (:x p2) (:y p0))
p3 (gpt/point (:x p0) (:y p2))]
[p0 p1 p2 p3])
points))

View file

@ -463,7 +463,7 @@
(cond-> modif-tree
snap-pixel? (gpp/adjust-pixel-precision objects snap-precision snap-ignore-axis))
bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points]))
bounds (d/lazy-map (keys objects) #(gco/shape->points (get objects %)))
bounds (cond-> bounds
(some? old-modif-tree)
(transform-bounds objects old-modif-tree))

View file

@ -58,7 +58,7 @@
(defn set-pixel-precision
"Adjust modifiers so they adjust to the pixel grid"
[modifiers shape precision ignore-axis]
(let [points (-> shape :points (gco/transform-points (ctm/modifiers->transform modifiers)))
(let [points (-> shape gco/shape->points (gco/transform-points (ctm/modifiers->transform modifiers)))
has-resize? (not (ctm/only-move? modifiers))
[modifiers points]

View file

@ -317,7 +317,7 @@
its properties. We adjust de x,y,width,height and create a custom transform"
[shape transform-mtx]
(let [points' (:points shape)
(let [points' (gco/shape->points shape)
points (gco/transform-points points' transform-mtx)
shape (-> shape (adjust-shape-flips points))
bool? (= (:type shape) :bool)