mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49: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
|
(mx/defc canvas
|
||||||
{:mixins [mx/static mx/reactive]}
|
{:mixins [mx/static mx/reactive]}
|
||||||
[{:keys [metadata id] :as page}]
|
[{:keys [metadata id] :as page} zoom]
|
||||||
(let [width (:width metadata)
|
(let [width (:width metadata)
|
||||||
height (:height metadata)]
|
height (:height metadata)]
|
||||||
[:svg.page-canvas {:x c/canvas-start-x
|
[:svg.page-canvas {:x c/canvas-start-x
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
(-> (uus/shape item)
|
(-> (uus/shape item)
|
||||||
(mx/with-key (str item))))
|
(mx/with-key (str item))))
|
||||||
(selection-handlers)
|
(selection-handlers)
|
||||||
(draw-area)]]]))
|
(draw-area zoom)]]]))
|
||||||
|
|
||||||
;; --- Viewport
|
;; --- Viewport
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@
|
||||||
:on-mouse-up on-mouse-up}
|
:on-mouse-up on-mouse-up}
|
||||||
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
||||||
(if page
|
(if page
|
||||||
(canvas page))
|
(canvas page zoom))
|
||||||
(if (contains? flags :grid)
|
(if (contains? flags :grid)
|
||||||
(grid))]
|
(grid))]
|
||||||
(ruler)
|
(ruler)
|
||||||
|
|
|
@ -36,16 +36,25 @@
|
||||||
|
|
||||||
(mx/defc draw-area
|
(mx/defc draw-area
|
||||||
{:mixins [mx/static mx/reactive]}
|
{:mixins [mx/static mx/reactive]}
|
||||||
[]
|
[zoom]
|
||||||
(when-let [shape (mx/react drawing-shape)]
|
(when-let [shape (mx/react drawing-shape)]
|
||||||
(if (= (:type shape) :path)
|
(if (= (:type shape) :path)
|
||||||
(path-draw-area shape)
|
(path-draw-area shape)
|
||||||
(generic-draw-area shape))))
|
(generic-draw-area shape zoom))))
|
||||||
|
|
||||||
(mx/defc generic-draw-area
|
(mx/defc generic-draw-area
|
||||||
[shape]
|
[shape zoom]
|
||||||
(-> (assoc shape :drawing? true)
|
(let [{:keys [x1 y1 width height]} (geom/size shape)]
|
||||||
(shapes/render-component)))
|
[: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
|
(mx/defc path-draw-area
|
||||||
[{:keys [segments] :as shape}]
|
[{:keys [segments] :as shape}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue