mirror of
https://github.com/penpot/penpot.git
synced 2025-06-26 01:26:59 +02:00
🐛 Fix copies of snap to grid and show hide grid
This commit is contained in:
parent
4e9710ddfa
commit
cdab615cbb
32 changed files with 117 additions and 619 deletions
|
@ -23,12 +23,12 @@
|
|||
:colorpalette
|
||||
:element-options
|
||||
:rulers
|
||||
:display-grid
|
||||
:snap-grid
|
||||
:display-guides
|
||||
:snap-guides
|
||||
:scale-text
|
||||
:dynamic-alignment
|
||||
:display-artboard-names
|
||||
:snap-guides
|
||||
:snap-ruler-guides
|
||||
:show-pixel-grid
|
||||
:snap-pixel-grid})
|
||||
|
||||
|
@ -53,11 +53,11 @@
|
|||
:layers
|
||||
:element-options
|
||||
:rulers
|
||||
:display-grid
|
||||
:snap-grid
|
||||
:display-guides
|
||||
:snap-guides
|
||||
:dynamic-alignment
|
||||
:display-artboard-names
|
||||
:snap-guides
|
||||
:snap-ruler-guides
|
||||
:show-pixel-grid
|
||||
:snap-pixel-grid})
|
||||
|
||||
|
@ -89,6 +89,7 @@
|
|||
(update [_ state]
|
||||
(update state :workspace-layout
|
||||
(fn [flags]
|
||||
(prn flags)
|
||||
(if force?
|
||||
(conj flags flag)
|
||||
(if (contains? flags flag)
|
||||
|
|
|
@ -364,19 +364,12 @@
|
|||
:subsections [:main-menu]
|
||||
:fn #(st/emit! (dw/select-all))}
|
||||
|
||||
:toggle-grid {:tooltip (ds/meta "'")
|
||||
:toggle-guides {:tooltip (ds/meta "'")
|
||||
;;https://github.com/ccampbell/mousetrap/issues/85
|
||||
:command [(ds/c-mod "'") (ds/c-mod "219")]
|
||||
:show-command (ds/c-mod "'")
|
||||
:subsections [:main-menu]
|
||||
:fn #(st/emit! (toggle-layout-flag :display-grid))}
|
||||
|
||||
:toggle-snap-grid {:tooltip (ds/meta-shift "'")
|
||||
;;https://github.com/ccampbell/mousetrap/issues/85
|
||||
:command [(ds/c-mod "shift+'") (ds/c-mod "shift+219")]
|
||||
:show-command (ds/c-mod "shift+'")
|
||||
:subsections [:main-menu]
|
||||
:fn #(st/emit! (toggle-layout-flag :snap-grid))}
|
||||
:fn #(st/emit! (toggle-layout-flag :display-guides))}
|
||||
|
||||
:toggle-alignment {:tooltip (ds/meta "\\")
|
||||
:command (ds/c-mod "\\")
|
||||
|
@ -404,10 +397,17 @@
|
|||
:fn #(st/emit!
|
||||
(de/show-workspace-export-dialog))}
|
||||
|
||||
:toggle-snap-guide {:tooltip (ds/meta-shift "G")
|
||||
:command (ds/c-mod "shift+g")
|
||||
:subsections [:main-menu]
|
||||
:fn #(st/emit! (toggle-layout-flag :snap-guides))}
|
||||
:toggle-snap-ruler-guide {:tooltip (ds/meta-shift "G")
|
||||
:command (ds/c-mod "shift+g")
|
||||
:subsections [:main-menu]
|
||||
:fn #(st/emit! (toggle-layout-flag :snap-ruler-guides))}
|
||||
|
||||
:toggle-snap-guides {:tooltip (ds/meta-shift "'")
|
||||
;;https://github.com/ccampbell/mousetrap/issues/85
|
||||
:command [(ds/c-mod "shift+'") (ds/c-mod "shift+219")]
|
||||
:show-command (ds/c-mod "shift+'")
|
||||
:subsections [:main-menu]
|
||||
:fn #(st/emit! (toggle-layout-flag :snap-guides))}
|
||||
|
||||
:show-shortcuts {:tooltip "?"
|
||||
:command "?"
|
||||
|
@ -416,34 +416,34 @@
|
|||
|
||||
;; PANELS
|
||||
|
||||
:toggle-layers {:tooltip (ds/alt "L")
|
||||
:command (ds/a-mod "l")
|
||||
:subsections [:panels]
|
||||
:fn #(st/emit! (dw/go-to-layout :layers))}
|
||||
:toggle-layers {:tooltip (ds/alt "L")
|
||||
:command (ds/a-mod "l")
|
||||
:subsections [:panels]
|
||||
:fn #(st/emit! (dw/go-to-layout :layers))}
|
||||
|
||||
:toggle-assets {:tooltip (ds/alt "I")
|
||||
:command (ds/a-mod "i")
|
||||
:subsections [:panels]
|
||||
:fn #(st/emit! (dw/go-to-layout :assets))}
|
||||
:toggle-assets {:tooltip (ds/alt "I")
|
||||
:command (ds/a-mod "i")
|
||||
:subsections [:panels]
|
||||
:fn #(st/emit! (dw/go-to-layout :assets))}
|
||||
|
||||
:toggle-history {:tooltip (ds/alt "H")
|
||||
:command (ds/a-mod "h")
|
||||
:subsections [:panels]
|
||||
:fn #(emit-when-no-readonly (dw/go-to-layout :document-history))}
|
||||
:toggle-history {:tooltip (ds/alt "H")
|
||||
:command (ds/a-mod "h")
|
||||
:subsections [:panels]
|
||||
:fn #(emit-when-no-readonly (dw/go-to-layout :document-history))}
|
||||
|
||||
:toggle-colorpalette {:tooltip (ds/alt "P")
|
||||
:command (ds/a-mod "p")
|
||||
:subsections [:panels]
|
||||
:fn #(do (r/set-resize-type! :bottom)
|
||||
(emit-when-no-readonly (dw/remove-layout-flag :textpalette)
|
||||
(toggle-layout-flag :colorpalette)))}
|
||||
:toggle-colorpalette {:tooltip (ds/alt "P")
|
||||
:command (ds/a-mod "p")
|
||||
:subsections [:panels]
|
||||
:fn #(do (r/set-resize-type! :bottom)
|
||||
(emit-when-no-readonly (dw/remove-layout-flag :textpalette)
|
||||
(toggle-layout-flag :colorpalette)))}
|
||||
|
||||
:toggle-textpalette {:tooltip (ds/alt "T")
|
||||
:command (ds/a-mod "t")
|
||||
:subsections [:panels]
|
||||
:fn #(do (r/set-resize-type! :bottom)
|
||||
(emit-when-no-readonly (dw/remove-layout-flag :colorpalette)
|
||||
(toggle-layout-flag :textpalette)))}
|
||||
:toggle-textpalette {:tooltip (ds/alt "T")
|
||||
:command (ds/a-mod "t")
|
||||
:subsections [:panels]
|
||||
:fn #(do (r/set-resize-type! :bottom)
|
||||
(emit-when-no-readonly (dw/remove-layout-flag :colorpalette)
|
||||
(toggle-layout-flag :textpalette)))}
|
||||
|
||||
:hide-ui {:tooltip "\\"
|
||||
:command "\\"
|
||||
|
@ -482,10 +482,10 @@
|
|||
:subsections [:zoom-workspace]
|
||||
:fn identity}
|
||||
|
||||
:zoom-lense-decrease {:tooltip (ds/alt "Z")
|
||||
:command "alt+z"
|
||||
:subsections [:zoom-workspace]
|
||||
:fn identity}
|
||||
:zoom-lense-decrease {:tooltip (ds/alt "Z")
|
||||
:command "alt+z"
|
||||
:subsections [:zoom-workspace]
|
||||
:fn identity}
|
||||
|
||||
;; NAVIGATION
|
||||
|
||||
|
@ -553,11 +553,11 @@
|
|||
:fn #(emit-when-no-readonly (dp/open-preview-selected))}
|
||||
|
||||
;; THEME
|
||||
:toggle-theme {:tooltip (ds/alt "M")
|
||||
:command (ds/a-mod "m")
|
||||
:subsections [:basics]
|
||||
:fn #(st/emit! (with-meta (du/toggle-theme)
|
||||
{::ev/origin "workspace:shortcut"}))}})
|
||||
:toggle-theme {:tooltip (ds/alt "M")
|
||||
:command (ds/a-mod "m")
|
||||
:subsections [:basics]
|
||||
:fn #(st/emit! (with-meta (du/toggle-theme)
|
||||
{::ev/origin "workspace:shortcut"}))}})
|
||||
|
||||
(def opacity-shortcuts
|
||||
(into {} (->>
|
||||
|
|
|
@ -40,14 +40,14 @@
|
|||
(fn [{:keys [type id frame-id]}]
|
||||
(cond
|
||||
(= type :layout)
|
||||
(or (not (contains? layout :display-grid))
|
||||
(not (contains? layout :snap-grid))
|
||||
(or (not (contains? layout :display-guides))
|
||||
(not (contains? layout :snap-guides))
|
||||
(and (d/not-empty? focus)
|
||||
(not (contains? focus id))))
|
||||
|
||||
(= type :guide)
|
||||
(or (not (contains? layout :rulers))
|
||||
(not (contains? layout :snap-guides))
|
||||
(not (contains? layout :snap-ruler-guides))
|
||||
(and (d/not-empty? focus)
|
||||
(not (contains? focus frame-id))))
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
@use "refactor/common-refactor.scss" as *;
|
||||
|
||||
.dashboard {
|
||||
@extend .new-scrollbar;
|
||||
background-color: var(--app-background);
|
||||
display: grid;
|
||||
grid-template-columns: $s-40 $s-256 1fr;
|
||||
|
|
|
@ -192,15 +192,15 @@
|
|||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(toggle-flag event)))
|
||||
:data-test "snap-guides"
|
||||
:id "file-menu-snap-guides"}
|
||||
:data-test "snap-ruler-guides"
|
||||
:id "file-menu-snap-ruler-guides"}
|
||||
[:span {:class (stl/css :item-name)}
|
||||
(if (contains? layout :snap-guides)
|
||||
(tr "workspace.header.menu.disable-snap-guides")
|
||||
(tr "workspace.header.menu.enable-snap-guides"))]
|
||||
(if (contains? layout :snap-ruler-guides)
|
||||
(tr "workspace.header.menu.disable-snap-ruler-guides")
|
||||
(tr "workspace.header.menu.enable-snap-ruler-guides"))]
|
||||
[:span {:class (stl/css :shortcut)}
|
||||
|
||||
(for [sc (scd/split-sc (sc/get-tooltip :toggle-snap-guide))]
|
||||
(for [sc (scd/split-sc (sc/get-tooltip :toggle-snap-ruler-guide))]
|
||||
[:span {:class (stl/css :shortcut-key) :key sc} sc])]]
|
||||
|
||||
[:> dropdown-menu-item* {:on-click toggle-flag
|
||||
|
@ -208,14 +208,14 @@
|
|||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(toggle-flag event)))
|
||||
:data-test "snap-grid"
|
||||
:id "file-menu-snap-grid"}
|
||||
:data-test "snap-guides"
|
||||
:id "file-menu-snap-guides"}
|
||||
[:span {:class (stl/css :item-name)}
|
||||
(if (contains? layout :snap-grid)
|
||||
(tr "workspace.header.menu.disable-snap-grid")
|
||||
(tr "workspace.header.menu.enable-snap-grid"))]
|
||||
(if (contains? layout :snap-guides)
|
||||
(tr "workspace.header.menu.disable-snap-guides")
|
||||
(tr "workspace.header.menu.enable-snap-guides"))]
|
||||
[:span {:class (stl/css :shortcut)}
|
||||
(for [sc (scd/split-sc (sc/get-tooltip :toggle-snap-grid))]
|
||||
(for [sc (scd/split-sc (sc/get-tooltip :toggle-snap-guides))]
|
||||
[:span {:class (stl/css :shortcut-key) :key sc} sc])]]
|
||||
|
||||
[:> dropdown-menu-item* {:on-click toggle-flag
|
||||
|
@ -321,14 +321,14 @@
|
|||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(toggle-flag event)))
|
||||
:data-test "display-grid"
|
||||
:id "file-menu-grid"}
|
||||
:data-test "display-guides"
|
||||
:id "file-menu-guides"}
|
||||
[:span {:class (stl/css :item-name)}
|
||||
(if (contains? layout :display-grid)
|
||||
(tr "workspace.header.menu.hide-grid")
|
||||
(tr "workspace.header.menu.show-grid"))]
|
||||
(if (contains? layout :display-guides)
|
||||
(tr "workspace.header.menu.hide-guides")
|
||||
(tr "workspace.header.menu.show-guides"))]
|
||||
[:span {:class (stl/css :shortcut)}
|
||||
(for [sc (scd/split-sc (sc/get-tooltip :toggle-grid))]
|
||||
(for [sc (scd/split-sc (sc/get-tooltip :toggle-guides))]
|
||||
[:span {:class (stl/css :shortcut-key) :key sc} sc])]]
|
||||
|
||||
|
||||
|
|
|
@ -171,15 +171,15 @@
|
|||
;; shortcuts.toggle-assets
|
||||
;; shortcuts.toggle-colorpalette
|
||||
;; shortcuts.toggle-focus-mode
|
||||
;; shortcuts.toggle-grid
|
||||
;; shortcuts.toggle-guides
|
||||
;; shortcuts.toggle-history
|
||||
;; shortcuts.toggle-layers
|
||||
;; shortcuts.toggle-lock
|
||||
;; shortcuts.toggle-lock-size
|
||||
;; shortcuts.toggle-rules
|
||||
;; shortcuts.scale
|
||||
;; shortcuts.toggle-snap-grid
|
||||
;; shortcuts.toggle-snap-guide
|
||||
;; shortcuts.toggle-snap-guides
|
||||
;; shortcuts.toggle-snap-ruler-guide
|
||||
;; shortcuts.toggle-textpalette
|
||||
;; shortcuts.toggle-visibility
|
||||
;; shortcuts.toggle-zoom-style
|
||||
|
|
|
@ -200,7 +200,7 @@
|
|||
show-cursor-tooltip? tooltip
|
||||
show-draw-area? drawing-obj
|
||||
show-gradient-handlers? (= (count selected) 1)
|
||||
show-grids? (contains? layout :display-grid)
|
||||
show-grids? (contains? layout :display-guides)
|
||||
|
||||
show-frame-outline? (= transform :move)
|
||||
show-outlines? (and (nil? transform)
|
||||
|
@ -223,7 +223,7 @@
|
|||
(= transform :move)
|
||||
(seq selected))
|
||||
show-snap-points? (and (or (contains? layout :dynamic-alignment)
|
||||
(contains? layout :snap-grid))
|
||||
(contains? layout :snap-guides))
|
||||
(or drawing-obj transform))
|
||||
show-selrect? (and selrect (empty? drawing) (not text-editing?))
|
||||
show-measures? (and (not transform)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue