mirror of
https://github.com/penpot/penpot.git
synced 2025-03-18 10:41:29 -05:00
🐛 Fixed problem with right-click menu
This commit is contained in:
parent
9e348ecc99
commit
f3b779e50c
5 changed files with 14 additions and 9 deletions
|
@ -346,10 +346,12 @@
|
|||
(defn check-num
|
||||
"Function that checks if a number is nil or nan. Will return 0 when not
|
||||
valid and the number otherwise."
|
||||
[v]
|
||||
(if (or (not v)
|
||||
(not (mth/finite? v))
|
||||
(mth/nan? v)) 0 v))
|
||||
([v]
|
||||
(check-num v 0))
|
||||
([v default]
|
||||
(if (or (not v)
|
||||
(not (mth/finite? v))
|
||||
(mth/nan? v)) default v)))
|
||||
|
||||
|
||||
(defmacro export
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
(ns app.main.ui.workspace.viewport
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
@ -83,7 +84,7 @@
|
|||
;; STREAMS
|
||||
move-stream (mf/use-memo #(rx/subject))
|
||||
|
||||
zoom (or zoom 1)
|
||||
zoom (d/check-num zoom 1)
|
||||
drawing-tool (:tool drawing)
|
||||
drawing-obj (:object drawing)
|
||||
|
||||
|
|
|
@ -178,7 +178,8 @@
|
|||
(mf/use-callback
|
||||
(mf/deps @hover)
|
||||
(fn [event]
|
||||
(when (dom/class? (dom/get-target event) "viewport-controls")
|
||||
(when (or (dom/class? (dom/get-target event) "viewport-controls")
|
||||
(dom/class? (dom/get-target event) "viewport-selrect"))
|
||||
(dom/prevent-default event)
|
||||
|
||||
(let [position (dom/get-client-position event)]
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
(mf/defc outline
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
(let [shape (unchecked-get props "shape")
|
||||
zoom (unchecked-get props "zoom")
|
||||
(let [shape (obj/get props "shape")
|
||||
zoom (obj/get props "zoom" 1)
|
||||
|
||||
color (unchecked-get props "color")
|
||||
transform (gsh/transform-matrix shape)
|
||||
path? (= :path (:type shape))
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
(mf/defc selection-rect [{:keys [transform rect zoom color on-move-selected]}]
|
||||
(when rect
|
||||
(let [{:keys [x y width height]} rect]
|
||||
[:rect.main
|
||||
[:rect.main.viewport-selrect
|
||||
{:x x
|
||||
:y y
|
||||
:width width
|
||||
|
|
Loading…
Add table
Reference in a new issue