mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 18:31:39 +02:00
✨ Add cursor tooltips.
This commit is contained in:
parent
6988f0a35e
commit
a0a76f6b65
5 changed files with 48 additions and 24 deletions
|
@ -24,6 +24,7 @@
|
|||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.util.geom.path :as path]
|
||||
[uxbox.util.geom.point :as gpt]
|
||||
[uxbox.util.i18n :as i18n :refer [t]]
|
||||
[uxbox.util.uuid :as uuid]))
|
||||
|
||||
;; --- Events
|
||||
|
@ -319,16 +320,23 @@
|
|||
|
||||
(mf/defc path-draw-area
|
||||
[{:keys [shape] :as props}]
|
||||
(letfn [(on-click [event]
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/set-tooltip nil)
|
||||
close-drawing-path
|
||||
::end-path-drawing))
|
||||
(let [locale (i18n/use-locale)
|
||||
|
||||
(on-mouse-enter [event]
|
||||
(st/emit! (dw/set-tooltip "Click to close the path")))
|
||||
(on-mouse-leave [event]
|
||||
(st/emit! (dw/set-tooltip nil)))]
|
||||
on-click
|
||||
(fn [event]
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dw/assign-cursor-tooltip nil)
|
||||
close-drawing-path
|
||||
::end-path-drawing))
|
||||
|
||||
on-mouse-enter
|
||||
(fn [event]
|
||||
(let [msg (t locale "workspace.viewport.click-to-close-path")]
|
||||
(st/emit! (dw/assign-cursor-tooltip msg))))
|
||||
|
||||
on-mouse-leave
|
||||
(fn [event]
|
||||
(st/emit! (dw/assign-cursor-tooltip nil)))]
|
||||
(when-let [{:keys [x y] :as segment} (first (:segments shape))]
|
||||
[:g
|
||||
[:& shapes/shape-wrapper {:shape shape}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue