Merge branch 'main' into staging.

This commit is contained in:
Andrey Antukh 2022-01-24 16:07:06 +01:00
commit bfef94dbfb
4 changed files with 62 additions and 45 deletions

View file

@ -6,6 +6,7 @@
(ns app.main.ui.shapes.path
(:require
[app.common.logging :as log]
[app.main.ui.shapes.attrs :as attrs]
[app.main.ui.shapes.custom-stroke :refer [shape-custom-stroke]]
[app.util.object :as obj]
@ -19,10 +20,21 @@
[props]
(let [shape (unchecked-get props "shape")
content (:content shape)
pdata (mf/use-memo (mf/deps content) #(upf/format-path content))
pdata (mf/use-memo
(mf/deps content)
(fn []
(try
(upf/format-path content)
(catch :default e
(log/error :hint "unexpected error on formating path"
:shape-name (:name shape)
:shape-id (:id shape)
:cause e)
""))))
props (-> (attrs/extract-style-attrs shape)
(obj/merge!
#js {:d pdata}))]
[:& shape-custom-stroke {:shape shape}
[:> :path props]]))

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.viewport.outline
(:require
[app.common.exceptions :as ex]
[app.common.geom.shapes :as gsh]
[app.common.pages :as cp]
[app.main.refs :as refs]
@ -27,7 +28,9 @@
path-data
(mf/use-memo
(mf/deps shape)
#(when path? (upf/format-path (:content shape))))
#(when path?
(or (ex/ignoring (upf/format-path (:content shape)))
"")))
{:keys [x y width height selrect]} shape