0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

🐛 Fix coordinates component.

This commit is contained in:
Andrey Antukh 2019-08-12 16:50:44 +00:00
parent 5d5a7a21d2
commit 9aac5e91ab
3 changed files with 14 additions and 15 deletions

View file

@ -49,7 +49,8 @@
position: fixed;
right: 240px;
text-align: center;
width: 80px;
width: 100px;
padding-bottom: 2px;
span {
color: $color-white;

View file

@ -24,8 +24,7 @@
[uxbox.main.refs :as refs]
[uxbox.main.store :as st]
[uxbox.main.workers :as uwrk]
[uxbox.util.data :refer [dissoc-in]]
[uxbox.util.data :refer [index-of]]
[uxbox.util.data :refer [dissoc-in index-of]]
[uxbox.util.forms :as sc]
[uxbox.util.geom.matrix :as gmt]
[uxbox.util.geom.point :as gpt]

View file

@ -28,24 +28,23 @@
[uxbox.main.ui.workspace.selection :refer [selection-handlers]]
[uxbox.util.data :refer [parse-int]]
[uxbox.util.components :refer [use-rxsub]]
[uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt])
(:import goog.events.EventType))
;; --- Coordinates Widget
(mf/def coordinates
:mixins [mf/reactive mf/memo]
:render
(fn [own {:keys [zoom] :as props}]
(let [coords (some-> (mf/react refs/canvas-mouse-position)
(mf/defc coordinates
[{:keys [zoom] :as props}]
(let [coords (some-> (use-rxsub uws/viewport-mouse-position)
(gpt/divide zoom)
(gpt/round 0))]
[:ul.coordinates
[:span {:alt "x"}
(str "X: " (:x coords "-"))]
[:span {:alt "y"}
(str "Y: " (:y coords "-"))]])))
(str "Y: " (:y coords "-"))]]))
;; --- Cursor tooltip