mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 14:36:11 +02:00
✨ Guides cursors
This commit is contained in:
parent
62f7323acf
commit
39334b81ac
3 changed files with 10 additions and 3 deletions
|
@ -38,6 +38,9 @@
|
|||
(def resize-nwse (cursor-fn :resize-h 135))
|
||||
(def rotate (cursor-fn :rotate 90))
|
||||
|
||||
;;
|
||||
(def resize-ew-2 (cursor-fn :resize-h-2 0))
|
||||
(def resize-ns-2 (cursor-fn :resize-h-2 90))
|
||||
|
||||
(mf/defc debug-preview
|
||||
{::mf/wrap-props false}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.streams :as ms]
|
||||
[app.main.ui.cursors :as cur]
|
||||
[app.main.ui.workspace.viewport.rules :as rules]
|
||||
[app.util.dom :as dom]
|
||||
[rumext.alpha :as mf]))
|
||||
|
@ -272,7 +273,9 @@
|
|||
guide-width (/ guide-width zoom)
|
||||
guide-pill-corner-radius (/ guide-pill-corner-radius zoom)]
|
||||
|
||||
(when (or (nil? frame) (is-guide-inside-frame? (assoc guide :position pos) frame))
|
||||
(when (or (nil? frame)
|
||||
(is-guide-inside-frame? (assoc guide :position pos) frame)
|
||||
(:hover @state true))
|
||||
[:g.guide-area {:data-guide-frame-id (when (some? frame) (str (:id frame)))}
|
||||
(when-not disabled-guides?
|
||||
(let [{:keys [x y width height]} (guide-area-axis pos vbox zoom frame axis)]
|
||||
|
@ -282,7 +285,7 @@
|
|||
:height height
|
||||
:style {:fill "none"
|
||||
:pointer-events "fill"
|
||||
:cursor (if (= axis :x) "ew-resize" "ns-resize")}
|
||||
:cursor (if (= axis :x) (cur/resize-ew 0) (cur/resize-ns 0))}
|
||||
:on-pointer-enter on-pointer-enter
|
||||
:on-pointer-leave on-pointer-leave
|
||||
:on-pointer-down on-pointer-down
|
||||
|
@ -396,7 +399,7 @@
|
|||
:on-mouse-move on-mouse-move
|
||||
:style {:fill "none"
|
||||
:pointer-events "fill"
|
||||
:cursor (if (= axis :x) "ew-resize" "ns-resize")}}]))
|
||||
:cursor (if (= axis :x) (cur/resize-ew 0) (cur/resize-ns 0))}}]))
|
||||
|
||||
(when (:new-position @state)
|
||||
[:& guide {:guide {:axis axis
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue