0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-14 11:09:04 -05:00

🐛 Fix problem with 180 degree rotations

This commit is contained in:
alonso.torres 2022-07-14 15:01:39 +02:00
parent 8e9ab32a9f
commit b57ddf9dca
2 changed files with 2 additions and 9 deletions

View file

@ -35,6 +35,7 @@
- Fix problem with group coordinates [#2008](https://github.com/penpot/penpot/issues/2008) - Fix problem with group coordinates [#2008](https://github.com/penpot/penpot/issues/2008)
- Fix problem with line-height and texts [Taiga #3578](https://tree.taiga.io/project/penpot/issue/3578) - Fix problem with line-height and texts [Taiga #3578](https://tree.taiga.io/project/penpot/issue/3578)
- Fix moving frame-guides outside frames [Taiga #3839](https://tree.taiga.io/project/penpot/issue/3839) - Fix moving frame-guides outside frames [Taiga #3839](https://tree.taiga.io/project/penpot/issue/3839)
- Fix problem with 180 degree rotations [#2082](https://github.com/penpot/penpot/issues/2082)
### :arrow_up: Deps updates ### :arrow_up: Deps updates

View file

@ -251,11 +251,6 @@
(gmt/rotate-matrix (- rotation-angle)))] (gmt/rotate-matrix (- rotation-angle)))]
[stretch-matrix stretch-matrix-inverse rotation-angle]))) [stretch-matrix stretch-matrix-inverse rotation-angle])))
(defn is-rotated?
[[a b _c _d]]
;; true if either a-b or c-d are parallel to the axis
(not (mth/close? (:y a) (:y b))))
(defn- adjust-rotated-transform (defn- adjust-rotated-transform
[{:keys [transform transform-inverse flip-x flip-y]} points] [{:keys [transform transform-inverse flip-x flip-y]} points]
(let [center (gco/center-points points) (let [center (gco/center-points points)
@ -287,12 +282,9 @@
points (gco/transform-points points' transform-mtx) points (gco/transform-points points' transform-mtx)
bool? (= (:type shape) :bool) bool? (= (:type shape) :bool)
path? (= (:type shape) :path) path? (= (:type shape) :path)
rotated? (is-rotated? points)
[selrect transform transform-inverse] [selrect transform transform-inverse]
(if (not rotated?) (adjust-rotated-transform shape points)
[(gpr/points->selrect points) nil nil]
(adjust-rotated-transform shape points))
base-rotation (or (:rotation shape) 0) base-rotation (or (:rotation shape) 0)
modif-rotation (or (get-in shape [:modifiers :rotation]) 0) modif-rotation (or (get-in shape [:modifiers :rotation]) 0)