From 39334b81ace3f7e4bb0dcda80921c7677f21da6f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 24 Jan 2022 12:50:28 +0100 Subject: [PATCH] :sparkles: Guides cursors --- frontend/resources/images/cursors/resize-h-2.svg | 1 + frontend/src/app/main/ui/cursors.cljs | 3 +++ frontend/src/app/main/ui/workspace/viewport/guides.cljs | 9 ++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 frontend/resources/images/cursors/resize-h-2.svg diff --git a/frontend/resources/images/cursors/resize-h-2.svg b/frontend/resources/images/cursors/resize-h-2.svg new file mode 100644 index 000000000..5522037b1 --- /dev/null +++ b/frontend/resources/images/cursors/resize-h-2.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/app/main/ui/cursors.cljs b/frontend/src/app/main/ui/cursors.cljs index c52be6891..a57575099 100644 --- a/frontend/src/app/main/ui/cursors.cljs +++ b/frontend/src/app/main/ui/cursors.cljs @@ -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} diff --git a/frontend/src/app/main/ui/workspace/viewport/guides.cljs b/frontend/src/app/main/ui/workspace/viewport/guides.cljs index fd5a38918..25afe586c 100644 --- a/frontend/src/app/main/ui/workspace/viewport/guides.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/guides.cljs @@ -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