0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Adding tooltip to all shapes creation

This commit is contained in:
Jesús Espino 2016-12-22 10:29:34 +01:00
parent 0f21d11fd3
commit 1181c01f55
3 changed files with 22 additions and 4 deletions

View file

@ -50,7 +50,7 @@
background-color: $color-dark-bg;
border-radius: $br-small;
color: $color-white;
font-size: $fs14;
font-size: $fs12;
padding: 3px 8px;
transition: none;
text-align: center;

View file

@ -47,14 +47,16 @@
{:project project
:page page
:selected #{}
:drawing nil})
:drawing nil
:tooltip nil})
(assoc state :workspace
{:project project
:zoom 1
:page page
:flags #{:sitemap :drawtools :layers :element-options}
:selected #{}
:drawing nil})))
:drawing nil
:tooltip nil})))
ptk/WatchEvent
(watch [_ state s]

View file

@ -55,6 +55,20 @@
[:span {:alt "y"}
(str "Y: " (:y coords "-"))]]))
;; --- Cursor tooltip
(defn- get-shape-tooltip
"Return the shape tooltip text"
[shape]
(case (:type shape)
:icon "Click to place the Icon"
:image "Click to place the Image"
:rect "Drag to draw a Box"
:text "Drag to draw a Text Box"
:path "Click to draw a Path"
:circle "Drag to draw a Circle"
nil))
(mx/defc cursor-tooltip
{:mixins [mx/reactive mx/static]}
[tooltip]
@ -164,7 +178,9 @@
page (mx/react wb/page-ref)
flags (:flags workspace)
drawing? (:drawing workspace)
tooltip (:tooltip workspace)
tooltip (if (:tooltip workspace)
(:tooltip workspace)
(get-shape-tooltip drawing?))
zoom (or (:zoom workspace) 1)]
(letfn [(on-mouse-down [event]
(dom/stop-propagation event)