🐛 Fix several SVG upload issues

This commit is contained in:
alonso.torres 2024-01-22 18:03:59 +01:00 committed by Andrey Antukh
parent b6b2a3ec53
commit 4f09688af7
8 changed files with 63 additions and 28 deletions

View file

@ -215,11 +215,15 @@
([stream on-subscribe]
(use-stream stream (mf/deps) on-subscribe))
([stream deps on-subscribe]
(use-stream stream deps on-subscribe nil))
([stream deps on-subscribe on-dispose]
(mf/use-effect
deps
(fn []
(let [sub (->> stream (rx/subs! on-subscribe))]
#(rx/dispose! sub))))))
#(do
(rx/dispose! sub)
(when on-dispose (on-dispose))))))))
;; https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
(defn use-previous

View file

@ -157,7 +157,7 @@
[shape]
(add-layer-styles! #js {} shape))
(defn- get-svg-props
(defn get-svg-props
[shape render-id]
(let [attrs (get shape :svg-attrs {})
defs (get shape :svg-defs {})]

View file

@ -475,13 +475,17 @@
shape-shadow (get shape :shadow)
shape-strokes (get shape :strokes)
svg-attrs (attrs/get-svg-props shape render-id)
style (-> (obj/get props "style")
(obj/clone)
(attrs/add-layer-styles! shape))
props #js {:id stroke-id
:className "strokes"
:style style}
props (-> svg-attrs
(obj/merge!
{:id stroke-id
:className "strokes"
:style style}))
props (if ^boolean (cfh/frame-shape? shape)
props

View file

@ -299,11 +299,11 @@
(not (cfh/is-direct-child-of-root? shape))
(empty? (get shape :fills)))))
hover-shape
(->> ids
(remove remove-id?)
(remove (partial cfh/hidden-parent? objects))
(remove (partial cfh/svg-raw-shape? objects))
(remove #(and mod? (no-fill-nested-frames? %)))
(filter #(or (empty? focus) (cpf/is-in-focus? objects focus %)))
(first)
@ -315,6 +315,7 @@
(->> ids
(remove #(group-empty-space? % objects ids))
(remove (partial cfh/hidden-parent? objects))
(remove (partial cfh/svg-raw-shape? objects))
(remove #(and mod? (no-fill-nested-frames? %)))
(filter #(or (empty? focus) (cpf/is-in-focus? objects focus %)))
(first)

View file

@ -192,7 +192,10 @@
overlaps?
(fn [shape]
(if (and (false? using-selrect?) (empty? (:fills shape)))
(if (and (false? using-selrect?)
(empty? (:fills shape))
(not (contains? (-> shape :svg-attrs) :fill))
(not (contains? (-> shape :svg-attrs :style) :fill)))
(case (:type shape)
;; If the shape has no fills the overlap depends on the stroke
:rect (and (overlaps-outer-shape? shape) (not (overlaps-inner-shape? shape)))