mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 20:16:10 +02:00
Add invisible background to paths.
In order to make more easy to the user select and move them.
This commit is contained in:
parent
4a804ae467
commit
ac49728758
1 changed files with 16 additions and 9 deletions
|
@ -25,7 +25,9 @@
|
||||||
(let [modifiers (mx/react (common/modifiers-ref id))
|
(let [modifiers (mx/react (common/modifiers-ref id))
|
||||||
selected (mx/react common/selected-ref)
|
selected (mx/react common/selected-ref)
|
||||||
selected? (contains? selected id)
|
selected? (contains? selected id)
|
||||||
shape (assoc shape :modifiers modifiers)]
|
shape (assoc shape
|
||||||
|
:modifiers modifiers
|
||||||
|
:background? true)]
|
||||||
(letfn [(on-mouse-down [event]
|
(letfn [(on-mouse-down [event]
|
||||||
(common/on-mouse-down event shape selected))
|
(common/on-mouse-down event shape selected))
|
||||||
(on-double-click [event]
|
(on-double-click [event]
|
||||||
|
@ -61,14 +63,19 @@
|
||||||
|
|
||||||
(mx/defc path-shape
|
(mx/defc path-shape
|
||||||
{:mixins [mx/static]}
|
{:mixins [mx/static]}
|
||||||
[{:keys [id modifiers rotation] :as shape}]
|
[{:keys [id modifiers background?] :as shape}]
|
||||||
(let [{:keys [resize displacement]} modifiers
|
(let [{:keys [resize displacement]} modifiers
|
||||||
shape (cond-> shape
|
shape (cond-> shape
|
||||||
displacement (geom/transform displacement)
|
displacement (geom/transform displacement)
|
||||||
resize (geom/transform resize)
|
resize (geom/transform resize))
|
||||||
(pos? rotation) (geom/rotate-shape))
|
pdata (render-path shape)
|
||||||
|
attrs (merge {:id (str id) :d pdata}
|
||||||
props {:id (str id)
|
(attrs/extract-style-attrs shape))]
|
||||||
:d (render-path shape)}
|
(if background?
|
||||||
attrs (merge props (attrs/extract-style-attrs shape))]
|
[:g {}
|
||||||
[:path attrs]))
|
[:path {:stroke "transparent"
|
||||||
|
:fill "transparent"
|
||||||
|
:stroke-width "20px"
|
||||||
|
:d pdata}]
|
||||||
|
[:path attrs]]
|
||||||
|
[:path attrs])))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue