                                   (+ y (/ height 2))))]
       [:g {:transform transform}
        (for [item children]
-         [:& shape-wrapper {:frame frame
-                            :shape (cond-> item
-                                       displacement-modifier (assoc :displacement-modifier displacement-modifier)
-                                       resize-modifier (assoc :resize-modifier resize-modifier))
-                            :key (:id item)}])
-       
+         [:& shape-wrapper
+          {:frame frame
+           :shape (cond-> item
+                    displacement-modifier (assoc :displacement-modifier displacement-modifier)
+                    resize-modifier (assoc :resize-modifier resize-modifier))
+           :key (:id item)}])
+
        (when (not is-child-selected?)
          [:rect {:x x
                  :y y


(defonce ^:dynamic *debug* (atom false))

(declare translate-to-frame)
(declare group-shape)

(defn group-wrapper [shape-wrapper]
  (mf/fnc group-wrapper
   {::mf/wrap-props false}
   [props]
   (let [shape (unchecked-get props "shape")
         frame (unchecked-get props "frame")
         on-mouse-down #(common/on-mouse-down % shape)
         on-context-menu #(common/on-context-menu % shape)
         children (-> (refs/objects-by-id (:shapes shape)) mf/deref)
         is-child-selected? (-> (refs/is-child-selected? (:id shape)) mf/deref)
         on-double-click
         (fn [event]
           (dom/stop-propagation event)
           (dom/prevent-default event)
           (st/emit! (dw/select-inside-group
                      (:id shape)
                      @ms/mouse-position)))]

     [:g.shape {:on-mouse-down on-mouse-down
                :on-context-menu on-context-menu
                :on-double-click on-double-click}
      [:& (group-shape shape-wrapper) {:frame frame
                                       :shape (geom/transform-shape frame shape)
                                       :children children
                                       :is-child-selected? is-child-selected?}]])))

(defn group-shape [shape-wrapper]
  (mf/fnc group-shape
    {::mf/wrap-props false}
    [props]

;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL

(ns uxbox.main.ui.shapes.group
  (:require
