mirror of
https://github.com/penpot/penpot.git
synced 2025-07-29 20:07:15 +02:00
✨ Improved flex tracks behavior and auto sizing
This commit is contained in:
parent
06ab577e41
commit
e86939b8ee
7 changed files with 197 additions and 41 deletions
|
@ -597,6 +597,6 @@
|
|||
{:zoom zoom
|
||||
:objects base-objects
|
||||
:modifiers modifiers
|
||||
:shape (or (get objects-modified edition)
|
||||
:shape (or (get base-objects edition)
|
||||
(get base-objects @hover-top-frame-id))
|
||||
:view-only (not show-grid-editor?)}]])]]]))
|
||||
|
|
|
@ -40,8 +40,19 @@
|
|||
(let [children (->> (cph/get-immediate-children objects (:id shape))
|
||||
(remove :hidden))
|
||||
bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points]))
|
||||
layout-bounds (gsl/layout-content-bounds bounds shape children)
|
||||
layout-points (flatten (gsl/layout-content-points bounds shape children))]
|
||||
layout-bounds
|
||||
(cond (ctl/flex-layout? shape)
|
||||
(gsl/layout-content-bounds bounds shape children)
|
||||
|
||||
(ctl/grid-layout? shape)
|
||||
(gsg/layout-content-bounds bounds shape children))
|
||||
layout-points
|
||||
(cond (ctl/flex-layout? shape)
|
||||
(flatten (gsl/layout-content-points bounds shape children))
|
||||
|
||||
(ctl/grid-layout? shape)
|
||||
(flatten (gsg/layout-content-points bounds shape children)))]
|
||||
|
||||
[:g.debug-layout {:pointer-events "none"}
|
||||
[:polygon {:points (->> layout-bounds (map #(dm/fmt "%, %" (:x %) (:y %))) (str/join " "))
|
||||
:style {:stroke "red" :fill "none"}}]
|
||||
|
|
|
@ -665,11 +665,12 @@
|
|||
zoom (unchecked-get props "zoom")
|
||||
view-only (unchecked-get props "view-only")
|
||||
|
||||
shape (mf/use-memo
|
||||
(mf/deps modifiers base-shape)
|
||||
#(gsh/transform-shape
|
||||
base-shape
|
||||
(dm/get-in modifiers [(:id base-shape) :modifiers])))
|
||||
shape
|
||||
(mf/use-memo
|
||||
(mf/deps modifiers base-shape)
|
||||
#(gsh/transform-shape
|
||||
base-shape
|
||||
(dm/get-in modifiers [(:id base-shape) :modifiers])))
|
||||
|
||||
snap-pixel? (mf/deref refs/snap-pixel?)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue