                    :y 0
                    :width width
                    :height 20
-                   :class-name "workspace-frame-label"
-                   ;; Ensure that the label has always the same font size, regardless of zoom
+                   :class "workspace-frame-label"
+                   ;; Ensure that the label has always the same font
+                   ;; size, regardless of zoom
                    ;; https://css-tricks.com/transforms-on-svg-elements/
                    :transform (str
                                "scale(" inv-zoom ", " inv-zoom ") "
-                               "translate(" (* zoom (:x label-pos)) ", " (* zoom (:y label-pos)) ")")
+                               "translate(" (* zoom (:x label-pos)) ", "
+                               (* zoom (:y label-pos)) ")")
                    ;; User may also select the frame with single click in the label
                    :on-click on-double-click}
             (:name shape)]
-           [:& frame-shape {:shape (geom/transform-shape shape)
-                            :childs childs}]])))))
+           [:& frame-shape
+            {:shape (geom/transform-shape shape)
+             :childs childs}]])))))
 
 (defn frame-shape
   [shape-wrapper]
   (mf/fnc frame-shape
-    [{:keys [shape childs] :as props}]
-    (let [{:keys [id x y width height]} shape
+    {::mf/wrap-props false}
+    [props]
+    (let [childs (unchecked-get props "childs")
+          shape (unchecked-get props "shape")
+          {:keys [id x y width height]} shape
 
-          props (-> (attrs/extract-style-attrs shape)
+          props (-> (merge frame-default-props shape)
+                    (attrs/extract-style-attrs)
                     (itr/obj-assign!
                      #js {:x 0
                           :y 0


(defn frame-wrapper
  [shape-wrapper]
  (mf/fnc frame-wrapper
    {::mf/wrap [#(mf/memo' % frame-wrapper-memo-equals?)]}
    [{:keys [shape objects] :as props}]
    (let [selected-iref (-> (mf/deps (:id shape))
                            (mf/use-memo #(refs/make-selected (:id shape))))
          selected? (mf/deref selected-iref)
          zoom (mf/deref refs/selected-zoom)
          frame-shape (mf/use-memo #(frame-shape shape-wrapper))]
      (when (and shape (not (:hidden shape)))
        (let [on-mouse-down #(common/on-mouse-down % shape)
              on-context-menu #(common/on-context-menu % shape)
              shape (merge frame-default-props shape)

              {:keys [x y width height]} shape

              inv-zoom (/ 1 zoom)
              childs (mapv #(get objects %) (:shapes shape))
              ds-modifier (:displacement-modifier shape)

              label-pos (cond-> (gpt/point x (- y 10))
                          (gmt/matrix? ds-modifier) (gpt/transform ds-modifier))

              on-double-click
              (fn [event]
                (dom/prevent-default event)
                (st/emit! dw/deselect-all
                          (dw/select-shape (:id shape))))]
          [:g {:class (when selected? "selected")
               :on-context-menu on-context-menu
               :on-double-click on-double-click

;; 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.frame
  (:require
