mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 00:01:51 -05: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]
|
||||
(let [objects (wsh/lookup-page-objects state)
|
||||
srect (get-in objects [grid-id :selrect])]
|
||||
(prn srect)
|
||||
(-> state
|
||||
(update :workspace-local
|
||||
(fn [{:keys [zoom vport] :as local}]
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
(and (ctl/flex-layout? shape) (ctl/row? shape))
|
||||
i/layout-rows
|
||||
|
||||
;; TODO: GRID ICON
|
||||
(ctl/grid-layout? shape)
|
||||
i/grid-layout-mode
|
||||
|
||||
:else
|
||||
i/artboard)
|
||||
|
|
|
@ -204,7 +204,8 @@
|
|||
(>= zoom 8))
|
||||
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-presence? page-id
|
||||
|
@ -589,8 +590,9 @@
|
|||
{:id (first selected)
|
||||
: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
|
||||
{:zoom zoom
|
||||
:objects objects-modified
|
||||
|
@ -598,6 +600,5 @@
|
|||
(gsh/transform-shape
|
||||
(get base-objects @hover-top-frame-id)
|
||||
(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/deps shape track-before track-after)
|
||||
(fn []
|
||||
(prn "???" type (:name shape) index track-before track-after zoom snap-pixel?)
|
||||
(reset! start-size-before (:size track-before))
|
||||
(reset! start-size-after (:size track-after))
|
||||
(let [tracks-prop
|
||||
|
|
|
@ -167,13 +167,14 @@
|
|||
(mf/deps (:id frame) on-frame-leave)
|
||||
(fn [_]
|
||||
(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))
|
||||
[:g.frame-title {:id (dm/str "frame-title-" (:id frame))
|
||||
:transform (vwu/title-transform frame zoom grid-edition?)
|
||||
:pointer-events (when (:blocked frame) "none")}
|
||||
(when (:use-for-thumbnail? frame)
|
||||
(cond
|
||||
(or (:use-for-thumbnail? frame) grid-edition?)
|
||||
[:svg {:x 0
|
||||
:y -9
|
||||
:width 12
|
||||
|
@ -181,7 +182,13 @@
|
|||
:class "workspace-frame-icon"
|
||||
:style {:fill color}
|
||||
: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
|
||||
:y 0
|
||||
:width (:width frame)
|
||||
|
|
Loading…
Add table
Reference in a new issue