From a14890f163180c6c335413e6158d06aafeea9692 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 29 Mar 2021 11:56:36 +0200 Subject: [PATCH] :bug: Fix SVG not showing properties at code --- CHANGES.md | 1 + frontend/src/app/main/ui/handoff/render.cljs | 6 +++--- frontend/src/app/main/ui/shapes/svg_raw.cljs | 3 ++- .../app/main/ui/workspace/shapes/svg_raw.cljs | 17 ++--------------- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2d5e2d0160..40da84e060 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -62,6 +62,7 @@ - Fix issue with recent files not showing [Taiga #1493](https://tree.taiga.io/project/penpot/issue/1493) - Fix issue when promoting to owner [Taiga #1494](https://tree.taiga.io/project/penpot/issue/1494) - Fix cannot click on blocked elements in viewer [Taiga #1430](https://tree.taiga.io/project/penpot/issue/1430) +- Fix SVG not showing properties at code [Taiga #1437](https://tree.taiga.io/project/penpot/issue/1437) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/ui/handoff/render.cljs b/frontend/src/app/main/ui/handoff/render.cljs index a039dc3366..bcc0574b69 100644 --- a/frontend/src/app/main/ui/handoff/render.cljs +++ b/frontend/src/app/main/ui/handoff/render.cljs @@ -63,10 +63,10 @@ (let [shape (unchecked-get props "shape") childs (unchecked-get props "childs") frame (unchecked-get props "frame") - svg-element? (and (= :svg-raw (:type shape)) - (not= :svg (get-in shape [:content :tag])))] + render-wrapper? (or (not= :svg-raw (:type shape)) + (svg-raw/graphic-element? (get-in shape [:content :tag])))] - (if-not svg-element? + (if render-wrapper? [:> shape-container {:shape shape :on-mouse-enter (handle-hover-shape shape true) :on-mouse-leave (handle-hover-shape shape false) diff --git a/frontend/src/app/main/ui/shapes/svg_raw.cljs b/frontend/src/app/main/ui/shapes/svg_raw.cljs index f660392474..401221ce2a 100644 --- a/frontend/src/app/main/ui/shapes/svg_raw.cljs +++ b/frontend/src/app/main/ui/shapes/svg_raw.cljs @@ -21,7 +21,8 @@ [rumext.alpha :as mf])) ;; Graphic tags -(defonce graphic-element? #{:circle :ellipse :image :line :path :polygon :polyline :rect :text :use}) +(defonce graphic-element? + #{:svg :circle :ellipse :image :line :path :polygon :polyline :rect :symbol :text :textPath :use}) ;; Context to store a re-mapping of the ids (def svg-ids-ctx (mf/create-context nil)) diff --git a/frontend/src/app/main/ui/workspace/shapes/svg_raw.cljs b/frontend/src/app/main/ui/workspace/shapes/svg_raw.cljs index 57eefbb868..68ed9d629b 100644 --- a/frontend/src/app/main/ui/workspace/shapes/svg_raw.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/svg_raw.cljs @@ -16,10 +16,6 @@ [app.common.geom.shapes :as gsh] [app.main.ui.context :as muc])) -;; This is a list of svg tags that can be grouped in shape-container -;; this allows them to have gradients, shadows and masks -(def svg-elements #{:svg :circle :ellipse :image :line :path :polygon :polyline :rect :symbol :text :textPath :use}) - (defn svg-raw-wrapper-factory [shape-wrapper] (let [svg-raw-shape (svg-raw/svg-raw-shape shape-wrapper)] @@ -43,21 +39,12 @@ def-ctx? (mf/use-ctx muc/def-ctx)] (cond - (and (contains? svg-elements tag) (not def-ctx?)) + (and (svg-raw/graphic-element? tag) (not def-ctx?)) [:> shape-container { :shape shape } [:& svg-raw-shape {:frame frame :shape shape - :childs childs}] - - [:rect.actions - {:x x - :y y - :transform transform - :width width - :height height - :fill "transparent" - :stroke "none"}]] + :childs childs}]] ;; We cannot wrap inside groups the shapes that go inside the defs tag ;; we use the context so we know when we should not render the container