mirror of
https://github.com/penpot/penpot.git
synced 2025-01-28 09:30:07 -05:00
Cosmetic changes on drawarea ns.
This commit is contained in:
parent
56d64cf737
commit
ffa9d0e8d1
1 changed files with 13 additions and 19 deletions
|
@ -7,18 +7,17 @@
|
||||||
|
|
||||||
(ns uxbox.main.ui.workspace.drawarea
|
(ns uxbox.main.ui.workspace.drawarea
|
||||||
(:require [sablono.core :as html :refer-macros [html]]
|
(:require [sablono.core :as html :refer-macros [html]]
|
||||||
[rum.core :as rum]
|
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[lentes.core :as l]
|
[lentes.core :as l]
|
||||||
[uxbox.main.constants :as c]
|
|
||||||
[uxbox.util.rstore :as rs]
|
[uxbox.util.rstore :as rs]
|
||||||
|
[uxbox.util.mixins :as mx :include-macros true]
|
||||||
|
[uxbox.main.constants :as c]
|
||||||
[uxbox.main.state :as st]
|
[uxbox.main.state :as st]
|
||||||
[uxbox.main.data.workspace :as udw]
|
[uxbox.main.data.workspace :as udw]
|
||||||
[uxbox.main.data.shapes :as uds]
|
[uxbox.main.data.shapes :as uds]
|
||||||
[uxbox.main.ui.core :as uuc]
|
[uxbox.main.ui.core :as uuc]
|
||||||
[uxbox.main.ui.shapes :as shapes]
|
[uxbox.main.ui.shapes :as shapes]
|
||||||
[uxbox.main.ui.workspace.base :as wb]
|
[uxbox.main.ui.workspace.base :as wb]
|
||||||
[uxbox.util.mixins :as mx]
|
|
||||||
[uxbox.main.geom :as geom]
|
[uxbox.main.geom :as geom]
|
||||||
[uxbox.main.geom.point :as gpt]
|
[uxbox.main.geom.point :as gpt]
|
||||||
[uxbox.util.dom :as dom]))
|
[uxbox.util.dom :as dom]))
|
||||||
|
@ -32,15 +31,6 @@
|
||||||
|
|
||||||
(declare watch-draw-actions)
|
(declare watch-draw-actions)
|
||||||
|
|
||||||
(defn- draw-area-render
|
|
||||||
[own]
|
|
||||||
(let [shape (mx/react drawing-shape)
|
|
||||||
position (mx/react drawing-position)]
|
|
||||||
(when (and shape position)
|
|
||||||
(-> (assoc shape :drawing? true)
|
|
||||||
(geom/resize position)
|
|
||||||
(shapes/render-component)))))
|
|
||||||
|
|
||||||
(defn- draw-area-will-mount
|
(defn- draw-area-will-mount
|
||||||
[own]
|
[own]
|
||||||
(assoc own ::sub (watch-draw-actions)))
|
(assoc own ::sub (watch-draw-actions)))
|
||||||
|
@ -50,13 +40,17 @@
|
||||||
(.close (::sub own))
|
(.close (::sub own))
|
||||||
(dissoc own ::sub))
|
(dissoc own ::sub))
|
||||||
|
|
||||||
(def draw-area
|
(mx/defc draw-area
|
||||||
(mx/component
|
{:will-mount draw-area-will-mount
|
||||||
{:render draw-area-render
|
:will-unmount draw-area-will-unmount
|
||||||
:name "draw-area"
|
:mixins [mx/static mx/reactive]}
|
||||||
:will-mount draw-area-will-mount
|
[own]
|
||||||
:will-unmount draw-area-will-unmount
|
(let [shape (mx/react drawing-shape)
|
||||||
:mixins [mx/static mx/reactive]}))
|
position (mx/react drawing-position)]
|
||||||
|
(when (and shape position)
|
||||||
|
(-> (assoc shape :drawing? true)
|
||||||
|
(geom/resize position)
|
||||||
|
(shapes/render-component)))))
|
||||||
|
|
||||||
;; --- Drawing Logic
|
;; --- Drawing Logic
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue