mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 22:41:37 +02:00
Improved hack for defcs macro
This commit is contained in:
parent
bdf476e297
commit
23baa32879
1 changed files with 14 additions and 9 deletions
|
@ -193,6 +193,14 @@
|
||||||
[:div.element-icon (element-icon item)]
|
[:div.element-icon (element-icon item)]
|
||||||
(shape-name item)]])))
|
(shape-name item)]])))
|
||||||
|
|
||||||
|
|
||||||
|
;; TODO: Fix this temporary hack (Looks like a problem in defcs macro)
|
||||||
|
(declare layer-group)
|
||||||
|
(mx/defc defcs-macro-hack
|
||||||
|
{:mixins [mx/static mx/reactive (mx/local)]}
|
||||||
|
[shape selected]
|
||||||
|
(layer-group shape selected))
|
||||||
|
|
||||||
;; --- Layer Group (Component)
|
;; --- Layer Group (Component)
|
||||||
|
|
||||||
(mx/defcs layer-group
|
(mx/defcs layer-group
|
||||||
|
@ -202,14 +210,11 @@
|
||||||
selected? (contains? selected (:id item))
|
selected? (contains? selected (:id item))
|
||||||
collapsed? (:collapsed item true)
|
collapsed? (:collapsed item true)
|
||||||
shapes-map (mx/react wb/shapes-by-id-ref)
|
shapes-map (mx/react wb/shapes-by-id-ref)
|
||||||
;; TODO: Fix this temporary hack (Looks like a problem in defcs macro)
|
classes (classnames
|
||||||
classes (if (nil? own)
|
|
||||||
(classnames :selected selected?)
|
|
||||||
(classnames
|
|
||||||
:selected selected?
|
:selected selected?
|
||||||
:drag-top (= :top (:over @local))
|
:drag-top (= :top (:over @local))
|
||||||
:drag-bottom (= :bottom (:over @local))
|
:drag-bottom (= :bottom (:over @local))
|
||||||
:drag-inside (= :middle (:over @local))))
|
:drag-inside (= :middle (:over @local)))
|
||||||
select #(select-shape selected item %)
|
select #(select-shape selected item %)
|
||||||
toggle-visibility #(toggle-visibility selected item %)
|
toggle-visibility #(toggle-visibility selected item %)
|
||||||
toggle-blocking #(toggle-blocking item %)]
|
toggle-blocking #(toggle-blocking item %)]
|
||||||
|
@ -284,7 +289,7 @@
|
||||||
:let [key (str (:id shape))]]
|
:let [key (str (:id shape))]]
|
||||||
(if (= (:type shape) :group)
|
(if (= (:type shape) :group)
|
||||||
;; TODO: Fix this temporary hack (Looks like a problem in defcs macro)
|
;; TODO: Fix this temporary hack (Looks like a problem in defcs macro)
|
||||||
(-> (layer-group nil shape selected)
|
(-> (defcs-macro-hack shape selected)
|
||||||
(mx/with-key key))
|
(mx/with-key key))
|
||||||
(-> (layer-simple shape selected)
|
(-> (layer-simple shape selected)
|
||||||
(mx/with-key key))))])])))
|
(mx/with-key key))))])])))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue