mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
Merge pull request #2129 from penpot/palba/select-all-group
✨ Select all inside a group select only the objects at this …
This commit is contained in:
commit
fd08511514
2 changed files with 46 additions and 18 deletions
|
@ -29,7 +29,8 @@
|
||||||
- Improved share link options. Now you can allow non-team members to comment and/or inspect [Taiga #3056] (https://tree.taiga.io/project/penpot/us/3056)
|
- Improved share link options. Now you can allow non-team members to comment and/or inspect [Taiga #3056] (https://tree.taiga.io/project/penpot/us/3056)
|
||||||
- Signin/Signup from shared link [Taiga #3472](https://tree.taiga.io/project/penpot/us/3472)
|
- Signin/Signup from shared link [Taiga #3472](https://tree.taiga.io/project/penpot/us/3472)
|
||||||
- Support for import/export binary format [Taiga #2991](https://tree.taiga.io/project/penpot/us/2991)
|
- Support for import/export binary format [Taiga #2991](https://tree.taiga.io/project/penpot/us/2991)
|
||||||
- Comments positioning [Taiga #https://2007](tree.taiga.io/project/penpot/us/2007)
|
- Comments positioning [Taiga #2007](https://tree.taiga.io/project/penpot/us/2007)
|
||||||
|
- Select all inside a group select only the objects at this group level [Taiga #2382](https://tree.taiga.io/project/penpot/issue/2382)
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
|
|
@ -178,29 +178,56 @@
|
||||||
(let [objects (wsh/lookup-page-objects state)]
|
(let [objects (wsh/lookup-page-objects state)]
|
||||||
(rx/of (dwc/expand-all-parents ids objects))))))
|
(rx/of (dwc/expand-all-parents ids objects))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defn- select-siblings
|
||||||
|
[state parent]
|
||||||
|
(let [children (wsh/lookup-shapes state (:shapes parent))
|
||||||
|
selected (into (d/ordered-set)
|
||||||
|
(comp (remove :blocked) (map :id))
|
||||||
|
children)]
|
||||||
|
(rx/of (select-shapes selected))))
|
||||||
|
|
||||||
|
(defn- select-all-frame
|
||||||
|
[state]
|
||||||
|
(let [focus (:workspace-focus-selected state)
|
||||||
|
objects (-> (wsh/lookup-page-objects state)
|
||||||
|
(cp/focus-objects focus))
|
||||||
|
|
||||||
|
selected (let [frame-ids (into #{} (comp
|
||||||
|
(map (d/getf objects))
|
||||||
|
(map :frame-id))
|
||||||
|
(wsh/lookup-selected state))
|
||||||
|
frame-id (if (= 1 (count frame-ids))
|
||||||
|
(first frame-ids)
|
||||||
|
uuid/zero)]
|
||||||
|
(cph/get-immediate-children objects frame-id))
|
||||||
|
|
||||||
|
selected (into (d/ordered-set)
|
||||||
|
(comp (remove :blocked) (map :id))
|
||||||
|
selected)]
|
||||||
|
|
||||||
|
(rx/of (select-shapes selected))))
|
||||||
|
|
||||||
|
|
||||||
(defn select-all
|
(defn select-all
|
||||||
[]
|
[]
|
||||||
(ptk/reify ::select-all
|
(ptk/reify ::select-all
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [focus (:workspace-focus-selected state)
|
(let [current-selection-parents (->> (wsh/lookup-selected state)
|
||||||
objects (-> (wsh/lookup-page-objects state)
|
(wsh/lookup-shapes state)
|
||||||
(cp/focus-objects focus))
|
(into #{} (map :parent-id)))
|
||||||
|
num-parents (count current-selection-parents)
|
||||||
|
parent (when (= num-parents 1)
|
||||||
|
(wsh/lookup-shape state (first current-selection-parents)))]
|
||||||
|
|
||||||
selected (let [frame-ids (into #{} (comp
|
(case num-parents
|
||||||
(map (d/getf objects))
|
0 (select-all-frame state)
|
||||||
(map :frame-id))
|
1 (if (cph/frame-shape? parent)
|
||||||
(wsh/lookup-selected state))
|
(select-all-frame state)
|
||||||
frame-id (if (= 1 (count frame-ids))
|
(select-siblings state parent))
|
||||||
(first frame-ids)
|
nil)))))
|
||||||
uuid/zero)]
|
|
||||||
(cph/get-immediate-children objects frame-id))
|
|
||||||
|
|
||||||
selected (into (d/ordered-set)
|
|
||||||
(comp (remove :blocked) (map :id))
|
|
||||||
selected)]
|
|
||||||
|
|
||||||
(rx/of (select-shapes selected))))))
|
|
||||||
|
|
||||||
(defn deselect-all
|
(defn deselect-all
|
||||||
"Clear all possible state of drawing, edition
|
"Clear all possible state of drawing, edition
|
||||||
|
|
Loading…
Add table
Reference in a new issue