mirror of
https://github.com/penpot/penpot.git
synced 2025-07-29 14:07:14 +02:00
✨ Add grid icons to layers
This commit is contained in:
parent
5925d2520f
commit
f5bb6b05f3
5 changed files with 18 additions and 11 deletions
|
@ -52,7 +52,6 @@
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(let [objects (wsh/lookup-page-objects state)
|
(let [objects (wsh/lookup-page-objects state)
|
||||||
srect (get-in objects [grid-id :selrect])]
|
srect (get-in objects [grid-id :selrect])]
|
||||||
(prn srect)
|
|
||||||
(-> state
|
(-> state
|
||||||
(update :workspace-local
|
(update :workspace-local
|
||||||
(fn [{:keys [zoom vport] :as local}]
|
(fn [{:keys [zoom vport] :as local}]
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
(and (ctl/flex-layout? shape) (ctl/row? shape))
|
(and (ctl/flex-layout? shape) (ctl/row? shape))
|
||||||
i/layout-rows
|
i/layout-rows
|
||||||
|
|
||||||
;; TODO: GRID ICON
|
(ctl/grid-layout? shape)
|
||||||
|
i/grid-layout-mode
|
||||||
|
|
||||||
:else
|
:else
|
||||||
i/artboard)
|
i/artboard)
|
||||||
|
|
|
@ -204,7 +204,8 @@
|
||||||
(>= zoom 8))
|
(>= zoom 8))
|
||||||
show-text-editor? (and editing-shape (= :text (:type editing-shape)))
|
show-text-editor? (and editing-shape (= :text (:type editing-shape)))
|
||||||
|
|
||||||
hover-grid? (and (some? @hover-top-frame-id) (ctl/grid-layout? objects @hover-top-frame-id))
|
;; Debug utility
|
||||||
|
;; hover-grid? (and (some? @hover-top-frame-id) (ctl/grid-layout? objects @hover-top-frame-id))
|
||||||
|
|
||||||
show-grid-editor? (and editing-shape (ctl/grid-layout? editing-shape))
|
show-grid-editor? (and editing-shape (ctl/grid-layout? editing-shape))
|
||||||
show-presence? page-id
|
show-presence? page-id
|
||||||
|
@ -589,8 +590,9 @@
|
||||||
{:id (first selected)
|
{:id (first selected)
|
||||||
:zoom zoom}])
|
:zoom zoom}])
|
||||||
|
|
||||||
;; TODO: Temporary showing on hover. Remove eventualy
|
|
||||||
(when (or show-grid-editor? hover-grid?)
|
(when show-grid-editor?
|
||||||
|
#_(or show-grid-editor? hover-grid?) ;; Debug utility
|
||||||
[:& grid-layout/editor
|
[:& grid-layout/editor
|
||||||
{:zoom zoom
|
{:zoom zoom
|
||||||
:objects objects-modified
|
:objects objects-modified
|
||||||
|
@ -598,6 +600,5 @@
|
||||||
(gsh/transform-shape
|
(gsh/transform-shape
|
||||||
(get base-objects @hover-top-frame-id)
|
(get base-objects @hover-top-frame-id)
|
||||||
(dm/get-in modifiers [@hover-top-frame-id :modifiers])))
|
(dm/get-in modifiers [@hover-top-frame-id :modifiers])))
|
||||||
:view-only (not show-grid-editor?)
|
:view-only (not show-grid-editor?)}])
|
||||||
}])
|
|
||||||
]]]))
|
]]]))
|
||||||
|
|
|
@ -301,7 +301,6 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps shape track-before track-after)
|
(mf/deps shape track-before track-after)
|
||||||
(fn []
|
(fn []
|
||||||
(prn "???" type (:name shape) index track-before track-after zoom snap-pixel?)
|
|
||||||
(reset! start-size-before (:size track-before))
|
(reset! start-size-before (:size track-before))
|
||||||
(reset! start-size-after (:size track-after))
|
(reset! start-size-after (:size track-after))
|
||||||
(let [tracks-prop
|
(let [tracks-prop
|
||||||
|
|
|
@ -167,13 +167,14 @@
|
||||||
(mf/deps (:id frame) on-frame-leave)
|
(mf/deps (:id frame) on-frame-leave)
|
||||||
(fn [_]
|
(fn [_]
|
||||||
(on-frame-leave (:id frame))))
|
(on-frame-leave (:id frame))))
|
||||||
text-pos-x (if (:use-for-thumbnail? frame) 15 0)]
|
text-pos-x (if (or (:use-for-thumbnail? frame) grid-edition?) 15 0)]
|
||||||
|
|
||||||
(when (not (:hidden frame))
|
(when (not (:hidden frame))
|
||||||
[:g.frame-title {:id (dm/str "frame-title-" (:id frame))
|
[:g.frame-title {:id (dm/str "frame-title-" (:id frame))
|
||||||
:transform (vwu/title-transform frame zoom grid-edition?)
|
:transform (vwu/title-transform frame zoom grid-edition?)
|
||||||
:pointer-events (when (:blocked frame) "none")}
|
:pointer-events (when (:blocked frame) "none")}
|
||||||
(when (:use-for-thumbnail? frame)
|
(cond
|
||||||
|
(or (:use-for-thumbnail? frame) grid-edition?)
|
||||||
[:svg {:x 0
|
[:svg {:x 0
|
||||||
:y -9
|
:y -9
|
||||||
:width 12
|
:width 12
|
||||||
|
@ -181,7 +182,13 @@
|
||||||
:class "workspace-frame-icon"
|
:class "workspace-frame-icon"
|
||||||
:style {:fill color}
|
:style {:fill color}
|
||||||
:visibility (if show-artboard-names? "visible" "hidden")}
|
:visibility (if show-artboard-names? "visible" "hidden")}
|
||||||
[:use {:href "#icon-set-thumbnail"}]])
|
(cond
|
||||||
|
(:use-for-thumbnail? frame)
|
||||||
|
[:use {:href "#icon-set-thumbnail"}]
|
||||||
|
|
||||||
|
grid-edition?
|
||||||
|
[:use {:href "#icon-grid-layout-mode"}])])
|
||||||
|
|
||||||
[:text {:x text-pos-x
|
[:text {:x text-pos-x
|
||||||
:y 0
|
:y 0
|
||||||
:width (:width frame)
|
:width (:width frame)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue