🐛 Fix inconsistent representation of rectangles

This commit is contained in:
Alejandro Alonso 2022-08-12 14:26:05 +02:00 committed by Andrés Moya
parent 5c5ec8ef56
commit 7f7032aaa5
6 changed files with 45 additions and 16 deletions

View file

@ -224,7 +224,11 @@
#_:else (rect->path shape))
;; Apply the transforms that had the shape
transform (:transform shape)
transform
(cond-> (:transform shape (gmt/matrix))
(:flip-x shape) (gmt/scale (gpt/point -1 1))
(:flip-y shape) (gmt/scale (gpt/point 1 -1)))
new-content (cond-> new-content
(some? transform)
(gsp/transform-content (gmt/transform-in (gsc/center-shape shape) transform)))]

View file

@ -87,11 +87,17 @@
(defn set-radius-4
[shape attr value]
(cond-> shape
(:rx shape)
(-> (dissoc :rx :rx)
(assoc :r1 0 :r2 0 :r3 0 :r4 0))
(let [attr (cond->> attr
(:flip-x shape)
(get {:r1 :r2 :r2 :r1 :r3 :r4 :r4 :r3})
:always
(assoc attr value)))
(:flip-y shape)
(get {:r1 :r4 :r2 :r3 :r3 :r2 :r4 :r1}))]
(cond-> shape
(:rx shape)
(-> (dissoc :rx :rx)
(assoc :r1 0 :r2 0 :r3 0 :r4 0))
:always
(assoc attr value))))