mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 19:06:38 +02:00
Merge branch 'main' into develop
This commit is contained in:
commit
84a7ab8568
6 changed files with 61 additions and 26 deletions
|
@ -24,6 +24,12 @@
|
||||||
### :boom: Breaking changes
|
### :boom: Breaking changes
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
||||||
|
## 1.6.5-alpha
|
||||||
|
|
||||||
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- Fix problem with paths editing after flip [#1040](https://github.com/penpot/penpot/issues/1040)
|
||||||
|
|
||||||
## 1.6.4-alpha
|
## 1.6.4-alpha
|
||||||
|
|
||||||
### :sparkles: Minor improvements
|
### :sparkles: Minor improvements
|
||||||
|
|
|
@ -159,7 +159,9 @@
|
||||||
(defmethod pp/simple-dispatch Matrix [obj] (pr obj))
|
(defmethod pp/simple-dispatch Matrix [obj] (pr obj))
|
||||||
|
|
||||||
(defn transform-in [pt mtx]
|
(defn transform-in [pt mtx]
|
||||||
(-> (matrix)
|
(if (some? pt)
|
||||||
(translate pt)
|
(-> (matrix)
|
||||||
(multiply mtx)
|
(translate pt)
|
||||||
(translate (gpt/negate pt))))
|
(multiply mtx)
|
||||||
|
(translate (gpt/negate pt)))
|
||||||
|
mtx))
|
||||||
|
|
|
@ -298,21 +298,26 @@
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(-> shape
|
(-> shape
|
||||||
(merge rect-shape)))]
|
(merge rect-shape)))
|
||||||
|
|
||||||
|
base-rotation (or (:rotation shape) 0)
|
||||||
|
modif-rotation (or (get-in shape [:modifiers :rotation]) 0)]
|
||||||
|
|
||||||
(as-> shape $
|
(as-> shape $
|
||||||
(update $ :transform #(gmt/multiply (or % (gmt/matrix)) matrix))
|
(update $ :transform #(gmt/multiply (or % (gmt/matrix)) matrix))
|
||||||
(update $ :transform-inverse #(gmt/multiply matrix-inverse (or % (gmt/matrix))))
|
(update $ :transform-inverse #(gmt/multiply matrix-inverse (or % (gmt/matrix))))
|
||||||
(assoc $ :points (into [] points))
|
(assoc $ :points (into [] points))
|
||||||
(assoc $ :selrect (gpr/rect->selrect rect-shape))
|
(assoc $ :selrect (gpr/rect->selrect rect-shape))
|
||||||
(update $ :rotation #(mod (+ (or % 0)
|
(assoc $ :rotation (mod (+ base-rotation modif-rotation) 360)))))
|
||||||
(or (get-in $ [:modifiers :rotation]) 0)) 360)))))
|
|
||||||
|
|
||||||
(defn set-flip [shape modifiers]
|
(defn set-flip [shape modifiers]
|
||||||
(let [rx (get-in modifiers [:resize-vector :x])
|
(let [rx (get-in modifiers [:resize-vector :x])
|
||||||
ry (get-in modifiers [:resize-vector :y])]
|
ry (get-in modifiers [:resize-vector :y])]
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
(and rx (< rx 0)) (update :flip-x not)
|
(and rx (< rx 0)) (-> (update :flip-x not)
|
||||||
(and ry (< ry 0)) (update :flip-y not))))
|
(update :rotation -))
|
||||||
|
(and ry (< ry 0)) (-> (update :flip-y not)
|
||||||
|
(update :rotation -)))))
|
||||||
|
|
||||||
(defn apply-displacement [shape]
|
(defn apply-displacement [shape]
|
||||||
(let [modifiers (:modifiers shape)]
|
(let [modifiers (:modifiers shape)]
|
||||||
|
|
|
@ -7,7 +7,18 @@ WORKDIR /root
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apt-get -qq update; \
|
apt-get -qq update; \
|
||||||
apt-get -qqy --no-install-recommends install curl tzdata locales ca-certificates imagemagick webp fontconfig; \
|
apt-get -qqy --no-install-recommends install \
|
||||||
|
curl \
|
||||||
|
tzdata \
|
||||||
|
locales \
|
||||||
|
ca-certificates \
|
||||||
|
imagemagick \
|
||||||
|
webp \
|
||||||
|
fontconfig \
|
||||||
|
woff-tools \
|
||||||
|
woff2 \
|
||||||
|
fontforge \
|
||||||
|
; \
|
||||||
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
|
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
|
||||||
locale-gen; \
|
locale-gen; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
(uuid/next))]
|
(uuid/next))]
|
||||||
(update current-fonts id (fn [font]
|
(update current-fonts id (fn [font]
|
||||||
(-> font
|
(-> font
|
||||||
(assoc :name name)
|
(assoc :font-family name)
|
||||||
(assoc :font-id font-id))))))
|
(assoc :font-id font-id))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -26,12 +26,31 @@
|
||||||
(= event :interrupt) ;; ESC
|
(= event :interrupt) ;; ESC
|
||||||
(and (ms/mouse-double-click? event))))
|
(and (ms/mouse-double-click? event))))
|
||||||
|
|
||||||
|
(defn content-center
|
||||||
|
[content]
|
||||||
|
(-> content
|
||||||
|
gsh/content->selrect
|
||||||
|
gsh/center-selrect))
|
||||||
|
|
||||||
(defn content->points+selrect
|
(defn content->points+selrect
|
||||||
"Given the content of a shape, calculate its points and selrect"
|
"Given the content of a shape, calculate its points and selrect"
|
||||||
[shape content]
|
[shape content]
|
||||||
(let [transform (:transform shape (gmt/matrix))
|
|
||||||
transform-inverse (:transform-inverse shape (gmt/matrix))
|
(let [{:keys [flip-x flip-y]} shape
|
||||||
center (gsh/center-shape shape)
|
transform
|
||||||
|
(cond-> (:transform shape (gmt/matrix))
|
||||||
|
flip-x (gmt/scale (gpt/point -1 1))
|
||||||
|
flip-y (gmt/scale (gpt/point 1 -1)))
|
||||||
|
|
||||||
|
transform-inverse
|
||||||
|
(cond-> (gmt/matrix)
|
||||||
|
flip-x (gmt/scale (gpt/point -1 1))
|
||||||
|
flip-y (gmt/scale (gpt/point 1 -1))
|
||||||
|
:always (gmt/multiply (:transform-inverse shape (gmt/matrix))))
|
||||||
|
|
||||||
|
center (or (gsh/center-shape shape)
|
||||||
|
(content-center content))
|
||||||
|
|
||||||
base-content (gsh/transform-content
|
base-content (gsh/transform-content
|
||||||
content
|
content
|
||||||
(gmt/transform-in center transform-inverse))
|
(gmt/transform-in center transform-inverse))
|
||||||
|
@ -39,30 +58,22 @@
|
||||||
;; Calculates the new selrect with points given the old center
|
;; Calculates the new selrect with points given the old center
|
||||||
points (-> (gsh/content->selrect base-content)
|
points (-> (gsh/content->selrect base-content)
|
||||||
(gsh/rect->points)
|
(gsh/rect->points)
|
||||||
(gsh/transform-points center (:transform shape (gmt/matrix))))
|
(gsh/transform-points center transform))
|
||||||
|
|
||||||
points-center (gsh/center-points points)
|
points-center (gsh/center-points points)
|
||||||
|
|
||||||
;; Points is now the selrect but the center is different so we can create the selrect
|
;; Points is now the selrect but the center is different so we can create the selrect
|
||||||
;; through points
|
;; through points
|
||||||
selrect (-> points
|
selrect (-> points
|
||||||
(gsh/transform-points points-center (:transform-inverse shape (gmt/matrix)))
|
(gsh/transform-points points-center transform-inverse)
|
||||||
(gsh/points->selrect))]
|
(gsh/points->selrect))]
|
||||||
[points selrect]))
|
[points selrect]))
|
||||||
|
|
||||||
(defn update-selrect
|
(defn update-selrect
|
||||||
"Updates the selrect and points for a path"
|
"Updates the selrect and points for a path"
|
||||||
[shape]
|
[shape]
|
||||||
(if (= (:rotation shape 0) 0)
|
(let [[points selrect] (content->points+selrect shape (:content shape))]
|
||||||
(let [content (:content shape)
|
(assoc shape :points points :selrect selrect)))
|
||||||
selrect (gsh/content->selrect content)
|
|
||||||
points (gsh/rect->points selrect)]
|
|
||||||
(assoc shape :points points :selrect selrect))
|
|
||||||
|
|
||||||
(let [content (:content shape)
|
|
||||||
[points selrect] (content->points+selrect shape content)]
|
|
||||||
(assoc shape :points points :selrect selrect))))
|
|
||||||
|
|
||||||
|
|
||||||
(defn closest-angle
|
(defn closest-angle
|
||||||
[angle]
|
[angle]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue