Fixes tests and linter for commons

This commit is contained in:
alonso.torres 2020-12-01 17:27:19 +01:00 committed by Andrey Antukh
parent b180d9e878
commit f37a85fd82
23 changed files with 187 additions and 168 deletions

View file

@ -27,7 +27,22 @@
(assoc-in state [:workspace-drawing :object :initialized?] true))
(defn insert-point-segment [state point]
(update-in state [:workspace-drawing :object :segments] (fnil conj []) point))
(let [segments (-> state
(get-in [:workspace-drawing :object :segments])
(or [])
(conj point))
content (gsp/segments->content segments)
selrect (gsh/content->selrect content)
points (gsh/rect->points selrect)]
(-> state
(update-in [:workspace-drawing :object] assoc
:segments segments
:content content
:selrect selrect
:points points))))
(defn curve-to-path [{:keys [segments] :as shape}]
(let [content (gsp/segments->content segments)

View file

@ -12,6 +12,7 @@
[app.main.data.workspace.drawing :as dd]
[app.main.store :as st]
[app.main.ui.workspace.shapes :as shapes]
[app.main.ui.shapes.path :refer [path-shape]]
[app.main.ui.workspace.shapes.path.editor :refer [path-editor]]
[app.common.geom.shapes :as gsh]
[app.common.data :as d]
@ -22,13 +23,14 @@
(declare path-draw-area)
(mf/defc draw-area
[{:keys [shape zoom] :as props}]
[{:keys [shape zoom tool] :as props}]
[:g.draw-area
[:& shapes/shape-wrapper {:shape shape}]
(case (:type shape)
(case tool
:path [:& path-editor {:shape shape :zoom zoom}]
:curve [:& path-shape {:shape shape :zoom zoom}]
#_:default [:& generic-draw-area {:shape shape :zoom zoom}])])
(mf/defc generic-draw-area

View file

@ -592,6 +592,7 @@
(when drawing-obj
[:& draw-area {:shape drawing-obj
:zoom zoom
:tool drawing-tool
:modifiers (:modifiers local)}])
(when (contains? layout :display-grid)