mirror of
https://github.com/penpot/penpot.git
synced 2025-05-21 01:16:11 +02:00
🐛 Fix rotate several elements in bulk
This commit is contained in:
parent
8b7f791509
commit
fc018b18b3
3 changed files with 31 additions and 6 deletions
|
@ -74,7 +74,8 @@
|
||||||
- Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610)
|
- Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610)
|
||||||
- Fix retrieve user comments in dashboard [Taiga #5607](https://tree.taiga.io/project/penpot/issue/5607)
|
- Fix retrieve user comments in dashboard [Taiga #5607](https://tree.taiga.io/project/penpot/issue/5607)
|
||||||
- Locks shapes when moved inside a locked parent [Taiga #5252](https://tree.taiga.io/project/penpot/issue/5252)
|
- Locks shapes when moved inside a locked parent [Taiga #5252](https://tree.taiga.io/project/penpot/issue/5252)
|
||||||
|
- Fix rotate several elements in bulk [Taiga #5165](https://tree.taiga.io/project/penpot/issue/5165)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
- Update google fonts catalog (at 2023/07/06) [Taiga #5592](https://tree.taiga.io/project/penpot/issue/5592)
|
- Update google fonts catalog (at 2023/07/06) [Taiga #5592](https://tree.taiga.io/project/penpot/issue/5592)
|
||||||
|
|
|
@ -371,6 +371,32 @@
|
||||||
|
|
||||||
(assoc state :workspace-modifiers modif-tree))))))
|
(assoc state :workspace-modifiers modif-tree))))))
|
||||||
|
|
||||||
|
;; This function is similar to set-rotation-modifiers but:
|
||||||
|
;; - It consideres the center for everyshape instead of the center of the total selrect
|
||||||
|
;; - The angle param is the desired final value, not a delta
|
||||||
|
(defn set-delta-rotation-modifiers
|
||||||
|
([angle shapes]
|
||||||
|
(ptk/reify ::set-delta-rotation-modifiers
|
||||||
|
ptk/UpdateEvent
|
||||||
|
(update [_ state]
|
||||||
|
(let [objects (wsh/lookup-page-objects state)
|
||||||
|
ids
|
||||||
|
(->> shapes
|
||||||
|
(remove #(get % :blocked false))
|
||||||
|
(filter #((cpc/editable-attrs (:type %)) :rotation))
|
||||||
|
(map :id))
|
||||||
|
|
||||||
|
get-modifier
|
||||||
|
(fn [shape]
|
||||||
|
(let [delta (- angle (:rotation shape))
|
||||||
|
center (gsh/center-shape shape)]
|
||||||
|
(ctm/rotation-modifiers shape center delta)))
|
||||||
|
|
||||||
|
modif-tree
|
||||||
|
(-> (build-modif-tree ids objects get-modifier)
|
||||||
|
(gsh/set-objects-modifiers objects))]
|
||||||
|
|
||||||
|
(assoc state :workspace-modifiers modif-tree))))))
|
||||||
|
|
||||||
(defn apply-modifiers
|
(defn apply-modifiers
|
||||||
([]
|
([]
|
||||||
|
|
|
@ -343,12 +343,10 @@
|
||||||
|
|
||||||
(let [page-id (:current-page-id state)
|
(let [page-id (:current-page-id state)
|
||||||
objects (wsh/lookup-page-objects state page-id)
|
objects (wsh/lookup-page-objects state page-id)
|
||||||
rotate-shape (fn [shape]
|
shapes (->> ids (map #(get objects %)))]
|
||||||
(let [delta (- rotation (:rotation shape))]
|
|
||||||
(dwm/set-rotation-modifiers delta [shape])))]
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/from (->> ids (map #(get objects %)) (map rotate-shape)))
|
(rx/of (dwm/set-delta-rotation-modifiers rotation shapes))
|
||||||
(rx/of (dwm/apply-modifiers)))))))
|
(rx/of (dwm/apply-modifiers)))))))
|
||||||
|
|
||||||
|
|
||||||
;; -- Move ----------------------------------------------------------
|
;; -- Move ----------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue