mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05:00
Draw selection dashed-square when shape is drawing.
This commit is contained in:
parent
9f9bff17e5
commit
12f40744d2
2 changed files with 17 additions and 8 deletions
|
@ -104,7 +104,7 @@
|
|||
|
||||
(mx/defc canvas
|
||||
{:mixins [mx/static mx/reactive]}
|
||||
[{:keys [metadata id] :as page}]
|
||||
[{:keys [metadata id] :as page} zoom]
|
||||
(let [width (:width metadata)
|
||||
height (:height metadata)]
|
||||
[:svg.page-canvas {:x c/canvas-start-x
|
||||
|
@ -119,7 +119,7 @@
|
|||
(-> (uus/shape item)
|
||||
(mx/with-key (str item))))
|
||||
(selection-handlers)
|
||||
(draw-area)]]]))
|
||||
(draw-area zoom)]]]))
|
||||
|
||||
;; --- Viewport
|
||||
|
||||
|
@ -259,7 +259,7 @@
|
|||
:on-mouse-up on-mouse-up}
|
||||
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
||||
(if page
|
||||
(canvas page))
|
||||
(canvas page zoom))
|
||||
(if (contains? flags :grid)
|
||||
(grid))]
|
||||
(ruler)
|
||||
|
|
|
@ -36,16 +36,25 @@
|
|||
|
||||
(mx/defc draw-area
|
||||
{:mixins [mx/static mx/reactive]}
|
||||
[]
|
||||
[zoom]
|
||||
(when-let [shape (mx/react drawing-shape)]
|
||||
(if (= (:type shape) :path)
|
||||
(path-draw-area shape)
|
||||
(generic-draw-area shape))))
|
||||
(generic-draw-area shape zoom))))
|
||||
|
||||
(mx/defc generic-draw-area
|
||||
[shape]
|
||||
(-> (assoc shape :drawing? true)
|
||||
(shapes/render-component)))
|
||||
[shape zoom]
|
||||
(let [{:keys [x1 y1 width height]} (geom/size shape)]
|
||||
[:g
|
||||
(-> (assoc shape :drawing? true)
|
||||
(shapes/render-component))
|
||||
[:rect.main {:x x1 :y y1
|
||||
:width width
|
||||
:height height
|
||||
:stroke-dasharray (str (/ 5.0 zoom) "," (/ 5 zoom))
|
||||
:style {:stroke "#333" :fill "transparent"
|
||||
:stroke-opacity "1"}}]]))
|
||||
|
||||
|
||||
(mx/defc path-draw-area
|
||||
[{:keys [segments] :as shape}]
|
||||
|
|
Loading…
Reference in a new issue