mirror of
https://github.com/penpot/penpot.git
synced 2025-05-17 03:36:11 +02: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
|
(defn check-num
|
||||||
"Function that checks if a number is nil or nan. Will return 0 when not
|
"Function that checks if a number is nil or nan. Will return 0 when not
|
||||||
valid and the number otherwise."
|
valid and the number otherwise."
|
||||||
[v]
|
([v]
|
||||||
(if (or (not v)
|
(check-num v 0))
|
||||||
(not (mth/finite? v))
|
([v default]
|
||||||
(mth/nan? v)) 0 v))
|
(if (or (not v)
|
||||||
|
(not (mth/finite? v))
|
||||||
|
(mth/nan? v)) default v)))
|
||||||
|
|
||||||
|
|
||||||
(defmacro export
|
(defmacro export
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
(ns app.main.ui.workspace.viewport
|
(ns app.main.ui.workspace.viewport
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.data :as d]
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.ui.context :as ctx]
|
[app.main.ui.context :as ctx]
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
;; STREAMS
|
;; STREAMS
|
||||||
move-stream (mf/use-memo #(rx/subject))
|
move-stream (mf/use-memo #(rx/subject))
|
||||||
|
|
||||||
zoom (or zoom 1)
|
zoom (d/check-num zoom 1)
|
||||||
drawing-tool (:tool drawing)
|
drawing-tool (:tool drawing)
|
||||||
drawing-obj (:object drawing)
|
drawing-obj (:object drawing)
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,8 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps @hover)
|
(mf/deps @hover)
|
||||||
(fn [event]
|
(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)
|
(dom/prevent-default event)
|
||||||
|
|
||||||
(let [position (dom/get-client-position event)]
|
(let [position (dom/get-client-position event)]
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
(mf/defc outline
|
(mf/defc outline
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
(let [shape (unchecked-get props "shape")
|
(let [shape (obj/get props "shape")
|
||||||
zoom (unchecked-get props "zoom")
|
zoom (obj/get props "zoom" 1)
|
||||||
|
|
||||||
color (unchecked-get props "color")
|
color (unchecked-get props "color")
|
||||||
transform (gsh/transform-matrix shape)
|
transform (gsh/transform-matrix shape)
|
||||||
path? (= :path (:type shape))
|
path? (= :path (:type shape))
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
(mf/defc selection-rect [{:keys [transform rect zoom color on-move-selected]}]
|
(mf/defc selection-rect [{:keys [transform rect zoom color on-move-selected]}]
|
||||||
(when rect
|
(when rect
|
||||||
(let [{:keys [x y width height]} rect]
|
(let [{:keys [x y width height]} rect]
|
||||||
[:rect.main
|
[:rect.main.viewport-selrect
|
||||||
{:x x
|
{:x x
|
||||||
:y y
|
:y y
|
||||||
:width width
|
:width width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue