mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 23:51:40 +02:00
✨ New focus mode in workspace
This commit is contained in:
parent
dc18a6c3bc
commit
78d7fe3e10
26 changed files with 484 additions and 179 deletions
|
@ -7,7 +7,9 @@
|
|||
(ns app.main.ui.hooks
|
||||
"A collection of general purpose react hooks."
|
||||
(:require
|
||||
[app.common.pages :as cp]
|
||||
[app.main.data.shortcuts :as dsc]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.dom.dnd :as dnd]
|
||||
|
@ -235,3 +237,14 @@
|
|||
(let [ret (effect-fn)]
|
||||
(when (fn? ret) (ret)))
|
||||
(mf/use-effect deps effect-fn)))
|
||||
|
||||
(defn with-focus-objects
|
||||
([objects]
|
||||
(let [focus (mf/deref refs/workspace-focus-selected)]
|
||||
(with-focus-objects objects focus)))
|
||||
|
||||
([objects focus]
|
||||
(let [objects (mf/use-memo
|
||||
(mf/deps focus objects)
|
||||
#(cp/focus-objects objects focus))]
|
||||
objects)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue