🐛 Fix svg path parsing on uploading svg image

This commit is contained in:
Andrey Antukh 2025-05-19 15:30:16 +02:00
parent 8f2ca15ec0
commit 0b4a367e9e
5 changed files with 12 additions and 8 deletions

View file

@ -4,7 +4,7 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.common.svg.shapes-builder
(ns app.common.files.shapes-builder
"A SVG to Shapes builder."
(:require
[app.common.colors :as clr]
@ -21,7 +21,7 @@
[app.common.math :as mth]
[app.common.schema :as sm :refer [max-safe-int min-safe-int]]
[app.common.svg :as csvg]
[app.common.svg.path :as path]
[app.common.types.path :as path]
[app.common.types.path.segment :as path.segm]
[app.common.types.shape :as cts]
[app.common.uuid :as uuid]
@ -219,7 +219,7 @@
(defn create-path-shape [name frame-id svg-data {:keys [attrs] :as data}]
(when (and (contains? attrs :d) (seq (:d attrs)))
(let [transform (csvg/parse-transform (:transform attrs))
content (cond-> (path/parse (:d attrs))
content (cond-> (path/from-string (:d attrs))
(some? transform)
(path.segm/transform-content transform))

View file

@ -36,6 +36,10 @@
[data]
(impl/from-bytes data))
(defn from-string
[data]
(impl/from-string data))
(defn check-path-content
[content]
(impl/check-content-like content))