♻️ Make svg to shapes conversion code multiplatform

- Move clojure code to common
- Rewrite some native-js code into optimized clojure
This commit is contained in:
Andrey Antukh 2023-10-11 13:39:56 +02:00 committed by Andrés Moya
parent 44845d5d94
commit 3ceb4cf895
62 changed files with 2037 additions and 1011 deletions

View file

@ -6,15 +6,15 @@
(ns app.util.import.parser
(:require
[app.common.colors :as cc]
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.svg.path :as svg.path]
[app.common.types.shape.interactions :as ctsi]
[app.common.uuid :as uuid]
[app.util.color :as uc]
[app.util.json :as json]
[app.util.path.parser :as upp]
[cuerdas.core :as str]))
(def url-regex
@ -278,7 +278,7 @@
(defn parse-path
[props center svg-data]
(let [content (upp/parse-path (:d svg-data))]
(let [content (svg.path/parse (:d svg-data))]
(-> props
(assoc :content content)
(assoc :center center))))
@ -454,7 +454,7 @@
:fill-color nil
:fill-opacity nil)
(uc/hex? fill)
(cc/valid-hex-color? fill)
(assoc :fill-color fill
:fill-opacity (-> svg-data (:fill-opacity "1") d/parse-double))