mirror of
https://github.com/penpot/penpot.git
synced 2025-02-18 13:04:38 -05:00
🐛 Fix rotation of path and curve shapes.
This commit is contained in:
parent
85f4d4824f
commit
8d99bd723b
2 changed files with 16 additions and 8 deletions
|
@ -575,6 +575,7 @@
|
||||||
xf-resolve-shapes
|
xf-resolve-shapes
|
||||||
(comp (map shape->rect-shape)
|
(comp (map shape->rect-shape)
|
||||||
(map resolve-modifier)
|
(map resolve-modifier)
|
||||||
|
(map shape->rect-shape)
|
||||||
(map resolve-rotation)
|
(map resolve-rotation)
|
||||||
(map shape->rect-shape)))
|
(map shape->rect-shape)))
|
||||||
|
|
||||||
|
|
|
@ -62,23 +62,30 @@
|
||||||
(mf/defc path-shape
|
(mf/defc path-shape
|
||||||
[{:keys [shape background?] :as props}]
|
[{:keys [shape background?] :as props}]
|
||||||
(let [modifier-mtx (:modifier-mtx shape)
|
(let [modifier-mtx (:modifier-mtx shape)
|
||||||
|
rotation (:rotation shape)
|
||||||
|
|
||||||
shape (cond
|
shape (cond
|
||||||
(gmt/matrix? modifier-mtx) (geom/transform shape modifier-mtx)
|
(gmt/matrix? modifier-mtx) (geom/transform shape modifier-mtx)
|
||||||
:else shape)
|
:else shape)
|
||||||
|
|
||||||
moving? (boolean modifier-mtx)
|
{:keys [id x y width height]} (geom/shape->rect-shape shape)
|
||||||
|
|
||||||
|
transform (when (and rotation (pos? rotation))
|
||||||
|
(str/format "rotate(%s %s %s)"
|
||||||
|
rotation
|
||||||
|
(+ x (/ width 2))
|
||||||
|
(+ y (/ height 2))))
|
||||||
|
|
||||||
pdata (render-path shape)
|
pdata (render-path shape)
|
||||||
props {:id (str (:id shape))
|
props (-> (attrs/extract-style-attrs shape)
|
||||||
:class (classnames :move-cursor moving?)
|
(assoc :transform transform
|
||||||
:d pdata}
|
:id (str "shape-" id)
|
||||||
|
:d pdata))]
|
||||||
attrs (merge (attrs/extract-style-attrs shape) props)]
|
|
||||||
(if background?
|
(if background?
|
||||||
[:g
|
[:g
|
||||||
[:path {:stroke "transparent"
|
[:path {:stroke "transparent"
|
||||||
:fill "transparent"
|
:fill "transparent"
|
||||||
:stroke-width "20px"
|
:stroke-width "20px"
|
||||||
:d pdata}]
|
:d pdata}]
|
||||||
[:> :path (normalize-props attrs)]]
|
[:& "path" props]]
|
||||||
[:> :path (normalize-props attrs)])))
|
[:& "path" props])))
|
||||||
|
|
Loading…
Add table
Reference in a new issue