mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -05:00
✨ Align item to it's parent
This commit is contained in:
parent
86c394f4ce
commit
5c1b007c1b
2 changed files with 10 additions and 8 deletions
|
@ -6,12 +6,13 @@
|
|||
|
||||
### :sparkles: New features
|
||||
|
||||
- Scroll bars [Taiga #2550](https://tree.taiga.io/project/penpot/task/2550)
|
||||
- Allow to align items relative to groups [Taiga #2533](https://tree.taiga.io/project/penpot/us/2533).
|
||||
- Scroll bars [Taiga #2550](https://tree.taiga.io/project/penpot/task/2550).
|
||||
- Add select layer option to context menu [Taiga #2474](https://tree.taiga.io/project/penpot/us/2474).
|
||||
- Guides [Taiga #290](https://tree.taiga.io/project/penpot/us/290)
|
||||
- Guides [Taiga #290](https://tree.taiga.io/project/penpot/us/290).
|
||||
- Improve file menu by adding semantically groups [Github #1203](https://github.com/penpot/penpot/issues/1203).
|
||||
- Add update components in bulk option in context menu [Taiga #1975](https://tree.taiga.io/project/penpot/us/1975).
|
||||
- Create first E2E tests [Taiga #2608](https://tree.taiga.io/project/penpot/task/2608), [Taiga #2608](https://tree.taiga.io/project/penpot/task/2608)
|
||||
- Create first E2E tests [Taiga #2608](https://tree.taiga.io/project/penpot/task/2608), [Taiga #2608](https://tree.taiga.io/project/penpot/task/2608).
|
||||
|
||||
### :bug: Bugs fixed
|
||||
### :arrow_up: Deps updates
|
||||
|
|
|
@ -1148,7 +1148,7 @@
|
|||
|
||||
;; --- Shape / Selection Alignment and Distribution
|
||||
|
||||
(declare align-object-to-frame)
|
||||
(declare align-object-to-parent)
|
||||
(declare align-objects-list)
|
||||
|
||||
(defn can-align? [selected objects]
|
||||
|
@ -1168,7 +1168,7 @@
|
|||
objects (wsh/lookup-page-objects state page-id)
|
||||
selected (wsh/lookup-selected state)
|
||||
moved (if (= 1 (count selected))
|
||||
(align-object-to-frame objects (first selected) axis)
|
||||
(align-object-to-parent objects (first selected) axis)
|
||||
(align-objects-list objects selected axis))
|
||||
moved-objects (->> moved (group-by :id))
|
||||
ids (keys moved-objects)
|
||||
|
@ -1176,11 +1176,12 @@
|
|||
(when (can-align? selected objects)
|
||||
(rx/of (dch/update-shapes ids update-fn {:reg-objects? true})))))))
|
||||
|
||||
(defn align-object-to-frame
|
||||
(defn align-object-to-parent
|
||||
[objects object-id axis]
|
||||
(let [object (get objects object-id)
|
||||
frame (get objects (:frame-id object))]
|
||||
(gal/align-to-rect object frame axis objects)))
|
||||
parent (:parent-id (get objects object-id))
|
||||
parent-obj (get objects parent)]
|
||||
(gal/align-to-rect object parent-obj axis objects)))
|
||||
|
||||
(defn align-objects-list
|
||||
[objects selected axis]
|
||||
|
|
Loading…
Add table
Reference in a new issue