             [uxbox.main.ui.shapes.circle :refer (circle-shape)]
             [uxbox.view.ui.viewer.interactions :as itx])
   (:import goog.events.EventType))
+
+(def itx-flag-ref
+  (-> (comp (l/key :flags) (l/lens :interactions))
+      (l/derive st/state)))
 
 ;; --- Interactions Wrapper
 


(ns uxbox.view.ui.viewer.shapes
  (:require [goog.events :as events]
            [uxbox.util.mixins :as mx :include-macros true]
            [uxbox.main.state :as st]
            [uxbox.main.ui.shapes.rect :refer (rect-shape)]
            [uxbox.main.ui.shapes.icon :refer (icon-shape)]
            [uxbox.main.ui.shapes.text :refer (text-shape)]


(mx/defc interactions-wrapper
  {:did-mount interactions-wrapper-did-mount
   :will-unmount interactions-wrapper-will-unmount
   :mixins [mx/reactive mx/static]}
  [shape factory]
  (let [show-itx? (mx/react itx-flag-ref)
        rect (geom/inner-rect shape)]
    [:g {:id (str "itx-" (:id shape))}
     (factory shape)
     (when show-itx?
       [:circle {:fill "red"
                 :cx (:x rect)
                 :cy (:y rect)
                 :r 10}])]))

;; --- Shapes

