From 2dfa4f9ec9030e7ed2876270e7bf59476e5e86fb Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 30 Aug 2021 12:12:04 +0200 Subject: [PATCH] :sparkles: Add export/import to custom caps --- frontend/src/app/main/ui/shapes/export.cljs | 5 +++++ frontend/src/app/util/import/parser.cljs | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/export.cljs b/frontend/src/app/main/ui/shapes/export.cljs index e4d5fe06f..7f1d3bcb9 100644 --- a/frontend/src/app/main/ui/shapes/export.cljs +++ b/frontend/src/app/main/ui/shapes/export.cljs @@ -62,6 +62,7 @@ group? (= :group (:type shape)) rect? (= :rect (:type shape)) text? (= :text (:type shape)) + path? (= :path (:type shape)) mask? (and group? (:masked-group? shape)) center (gsh/center-shape shape)] (-> props @@ -92,6 +93,10 @@ (add! :r3) (add! :r4))) + (cond-> path? + (-> (add! :stroke-cap-start) + (add! :stroke-cap-end))) + (cond-> text? (-> (add! :grow-type) (add! :content (comp json/encode uuid->string)))) diff --git a/frontend/src/app/util/import/parser.cljs b/frontend/src/app/util/import/parser.cljs index 8de2abf37..f4628f478 100644 --- a/frontend/src/app/util/import/parser.cljs +++ b/frontend/src/app/util/import/parser.cljs @@ -373,7 +373,9 @@ stroke-alignment (get-meta node :stroke-alignment keyword) stroke (:stroke svg-data) gradient (when (str/starts-with? stroke "url") - (parse-gradient node stroke))] + (parse-gradient node stroke)) + stroke-cap-start (get-meta node :stroke-cap-start keyword) + stroke-cap-end (get-meta node :stroke-cap-end keyword)] (cond-> props :always @@ -389,7 +391,13 @@ :stroke-opacity nil) (= stroke-alignment :inner) - (update :stroke-width / 2)))) + (update :stroke-width / 2) + + (some? stroke-cap-start) + (assoc :stroke-cap-start stroke-cap-start) + + (some? stroke-cap-end) + (assoc :stroke-cap-end stroke-cap-end)))) (defn add-rect-data [props node svg-data]