mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 20:56:11 +02:00
🐛 Fixed measurements showing with itself
This commit is contained in:
parent
8f1b373c3d
commit
fd620a858c
1 changed files with 18 additions and 16 deletions
|
@ -205,21 +205,22 @@
|
||||||
(let [center-x (+ x1 (/ (- x2 x1) 2))
|
(let [center-x (+ x1 (/ (- x2 x1) 2))
|
||||||
center-y (+ y1 (/ (- y2 y1) 2))
|
center-y (+ y1 (/ (- y2 y1) 2))
|
||||||
distance (gpt/distance (gpt/point x1 y1) (gpt/point x2 y2))]
|
distance (gpt/distance (gpt/point x1 y1) (gpt/point x2 y2))]
|
||||||
[:g.distance-line {:key (str "line-%s-%s-%s-%s" x1 y1 x2 y2)}
|
(when-not (mth/almost-zero? distance)
|
||||||
[:line
|
[:g.distance-line {:key (str "line-%s-%s-%s-%s" x1 y1 x2 y2)}
|
||||||
{:x1 x1
|
[:line
|
||||||
:y1 y1
|
{:x1 x1
|
||||||
:x2 x2
|
:y1 y1
|
||||||
:y2 y2
|
:x2 x2
|
||||||
:style {:stroke distance-color
|
:y2 y2
|
||||||
:stroke-width distance-line-stroke}}]
|
:style {:stroke distance-color
|
||||||
|
:stroke-width distance-line-stroke}}]
|
||||||
|
|
||||||
[:& distance-display-pill
|
[:& distance-display-pill
|
||||||
{:x center-x
|
{:x center-x
|
||||||
:y center-y
|
:y center-y
|
||||||
:zoom zoom
|
:zoom zoom
|
||||||
:distance (str (mth/round distance) "px")
|
:distance (str (mth/round distance) "px")
|
||||||
:bounds bounds}]]))))
|
:bounds bounds}]])))))
|
||||||
|
|
||||||
(mf/defc selection-guides [{:keys [bounds selrect zoom]}]
|
(mf/defc selection-guides [{:keys [bounds selrect zoom]}]
|
||||||
[:g.selection-guides
|
[:g.selection-guides
|
||||||
|
@ -233,11 +234,12 @@
|
||||||
:stroke-dasharray (/ select-guide-dasharray zoom)}}])])
|
:stroke-dasharray (/ select-guide-dasharray zoom)}}])])
|
||||||
|
|
||||||
(mf/defc measurement [{:keys [bounds frame selected-shapes hover-shape zoom]}]
|
(mf/defc measurement [{:keys [bounds frame selected-shapes hover-shape zoom]}]
|
||||||
(let [selected-selrect (gsh/selection-rect selected-shapes)
|
(let [selected-ids (into #{} (map :id) selected-shapes)
|
||||||
|
selected-selrect (gsh/selection-rect selected-shapes)
|
||||||
hover-selrect (:selrect hover-shape)
|
hover-selrect (:selrect hover-shape)
|
||||||
bounds-selrect (bound->selrect bounds)]
|
bounds-selrect (bound->selrect bounds)]
|
||||||
|
|
||||||
(when (seq selected-shapes)
|
(when (and (seq selected-shapes) (not (contains? selected-ids (:id hover-shape))))
|
||||||
[:g.measurement-feedback {:pointer-events "none"}
|
[:g.measurement-feedback {:pointer-events "none"}
|
||||||
[:& selection-guides {:selrect selected-selrect :bounds bounds :zoom zoom}]
|
[:& selection-guides {:selrect selected-selrect :bounds bounds :zoom zoom}]
|
||||||
[:& size-display {:selrect selected-selrect :zoom zoom}]
|
[:& size-display {:selrect selected-selrect :zoom zoom}]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue