Allow ungroup toplevel group.

Related to issue #72.
This commit is contained in:
Andrey Antukh 2017-03-08 20:20:45 +01:00
parent d8b21aa350
commit 1835b496d1
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
2 changed files with 23 additions and 38 deletions

View file

@ -288,7 +288,6 @@
"Check if the current situation allows grouping
of the currently selected shapes."
[selected shapes-map]
;; TODO: transducers
(let [xform (comp (map shapes-map)
(map :group))
groups (into #{} xform selected)]
@ -298,11 +297,12 @@
"Check if the current situation allows ungrouping
of the currently selected shapes."
[selected shapes-map]
(let [xform (comp (map shapes-map)
(map :group))
groups (into #{} xform selected)]
(and (= 1 (count groups))
(not (nil? (first groups))))))
(let [shapes (into #{} (map shapes-map) selected)
groups (into #{} (map :group) shapes)]
(or (and (= 1 (count shapes))
(= :group (:type (first shapes))))
(and (= 1 (count groups))
(not (nil? (first groups)))))))
(mx/defc layers-tools
"Layers widget options buttons."