mirror of
https://github.com/penpot/penpot.git
synced 2025-06-13 06:01:37 +02:00
💄 Minor improvements on outlines component.
This commit is contained in:
parent
b68a076e57
commit
a1ff567b30
1 changed files with 25 additions and 22 deletions
|
@ -116,6 +116,21 @@
|
||||||
|
|
||||||
(declare remote-user-cursors)
|
(declare remote-user-cursors)
|
||||||
|
|
||||||
|
(mf/defc shape-outlines
|
||||||
|
{::mf/wrap-props false}
|
||||||
|
[props]
|
||||||
|
(let [objects (unchecked-get props "objects")
|
||||||
|
selected? (or (mf/deref refs/selected-shapes) #{})
|
||||||
|
hover? (or (mf/deref refs/current-hover) #{})
|
||||||
|
outline? (set/union selected? hover?)
|
||||||
|
shapes (->> (vals objects) (filter (comp outline? :id)))
|
||||||
|
transform (mf/deref refs/current-transform)]
|
||||||
|
(when (nil? transform)
|
||||||
|
[:g.outlines
|
||||||
|
(for [shape shapes]
|
||||||
|
[:& outline {:key (str "outline-" (:id shape))
|
||||||
|
:shape (gsh/transform-shape shape)}])])))
|
||||||
|
|
||||||
(mf/defc frames
|
(mf/defc frames
|
||||||
{:wrap [mf/memo]}
|
{:wrap [mf/memo]}
|
||||||
[]
|
[]
|
||||||
|
@ -124,27 +139,17 @@
|
||||||
root (get objects uuid/zero)
|
root (get objects uuid/zero)
|
||||||
shapes (->> (:shapes root)
|
shapes (->> (:shapes root)
|
||||||
(map #(get objects %)))]
|
(map #(get objects %)))]
|
||||||
[:g.shapes
|
[:*
|
||||||
(for [item shapes]
|
[:g.shapes
|
||||||
(if (= (:type item) :frame)
|
(for [item shapes]
|
||||||
[:& frame-wrapper {:shape item
|
(if (= (:type item) :frame)
|
||||||
:key (:id item)
|
[:& frame-wrapper {:shape item
|
||||||
:objects objects}]
|
:key (:id item)
|
||||||
[:& shape-wrapper {:shape item
|
:objects objects}]
|
||||||
:key (:id item)}]))]))
|
[:& shape-wrapper {:shape item
|
||||||
|
:key (:id item)}]))]
|
||||||
|
|
||||||
(mf/defc shape-outlines []
|
[:& shape-outlines {:objects objects}]]))
|
||||||
(let [selected-shape? (or (mf/deref refs/selected-shapes) #{})
|
|
||||||
hover? (or (mf/deref refs/current-hover) #{})
|
|
||||||
outline? (set/union selected-shape? hover?)
|
|
||||||
data (mf/deref refs/workspace-data)
|
|
||||||
shapes (->> data :objects vals (filter (comp outline? :id)))
|
|
||||||
current-transform (mf/deref refs/current-transform)]
|
|
||||||
(when (nil? current-transform)
|
|
||||||
[:g.outlines
|
|
||||||
(for [shape shapes]
|
|
||||||
[:& outline {:key (str "outline-" (:id shape))
|
|
||||||
:shape (gsh/transform-shape shape)}])])))
|
|
||||||
|
|
||||||
(mf/defc viewport
|
(mf/defc viewport
|
||||||
[{:keys [page local layout] :as props}]
|
[{:keys [page local layout] :as props}]
|
||||||
|
@ -432,8 +437,6 @@
|
||||||
[:g
|
[:g
|
||||||
[:& frames {:key (:id page)}]
|
[:& frames {:key (:id page)}]
|
||||||
|
|
||||||
[:& shape-outlines]
|
|
||||||
|
|
||||||
(when (seq selected)
|
(when (seq selected)
|
||||||
[:& selection-handlers {:selected selected
|
[:& selection-handlers {:selected selected
|
||||||
:zoom zoom
|
:zoom zoom
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue