mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
69008fbb90
2 changed files with 3 additions and 75 deletions
|
@ -340,76 +340,6 @@
|
||||||
(when (some? guides)
|
(when (some? guides)
|
||||||
(into [] (map parse-frame-guide) guides)))
|
(into [] (map parse-frame-guide) guides)))
|
||||||
|
|
||||||
;;interface PathCommand {
|
|
||||||
;; command:
|
|
||||||
;; | 'M' | 'move-to'
|
|
||||||
;; | 'Z' | 'close-path'
|
|
||||||
;; | 'L' | 'line-to'
|
|
||||||
;; | 'H' | 'line-to-horizontal'
|
|
||||||
;; | 'V' | 'line-to-vertical'
|
|
||||||
;; | 'C' | 'curve-to'
|
|
||||||
;; | 'S' | 'smooth-curve-to'
|
|
||||||
;; | 'Q' | 'quadratic-bezier-curve-to'
|
|
||||||
;; | 'T' | 'smooth-quadratic-bezier-curve-to'
|
|
||||||
;; | 'A' | 'elliptical-arc';
|
|
||||||
;;
|
|
||||||
;; params?: {
|
|
||||||
;; x?: number;
|
|
||||||
;; y?: number;
|
|
||||||
;; c1x: number;
|
|
||||||
;; c1y: number;
|
|
||||||
;; c2x: number;
|
|
||||||
;; c2y: number;
|
|
||||||
;; rx?: number;
|
|
||||||
;; ry?: number;
|
|
||||||
;; xAxisRotation?: number;
|
|
||||||
;; largeArcFlag?: boolean;
|
|
||||||
;; sweepFlag?: boolean;
|
|
||||||
;; };
|
|
||||||
;;}
|
|
||||||
(defn parse-command-type
|
|
||||||
[^string command-type]
|
|
||||||
(case command-type
|
|
||||||
"M" :move-to
|
|
||||||
"Z" :close-path
|
|
||||||
"L" :line-to
|
|
||||||
"H" :line-to-horizontal
|
|
||||||
"V" :line-to-vertical
|
|
||||||
"C" :curve-to
|
|
||||||
"S" :smooth-curve-to
|
|
||||||
"Q" :quadratic-bezier-curve-to
|
|
||||||
"T" :smooth-quadratic-bezier-curve-to
|
|
||||||
"A" :elliptical-arc
|
|
||||||
(parse-keyword command-type)))
|
|
||||||
|
|
||||||
(defn parse-command-params
|
|
||||||
[^js params]
|
|
||||||
(when (some? params)
|
|
||||||
(d/without-nils
|
|
||||||
{:x (obj/get params "x")
|
|
||||||
:y (obj/get params "y")
|
|
||||||
:c1x (obj/get params "c1x")
|
|
||||||
:c1y (obj/get params "c1y")
|
|
||||||
:c2x (obj/get params "c2x")
|
|
||||||
:c2y (obj/get params "c2y")
|
|
||||||
:rx (obj/get params "rx")
|
|
||||||
:ry (obj/get params "ry")
|
|
||||||
:x-axis-rotation (obj/get params "xAxisRotation")
|
|
||||||
:large-arc-flag (obj/get params "largeArcFlag")
|
|
||||||
:sweep-flag (obj/get params "sweepFlag")})))
|
|
||||||
|
|
||||||
(defn parse-command
|
|
||||||
[^js command]
|
|
||||||
(when (some? command)
|
|
||||||
(d/without-nils
|
|
||||||
{:command (-> (obj/get command "command") parse-command-type)
|
|
||||||
:params (-> (obj/get command "params") parse-command-params)})))
|
|
||||||
|
|
||||||
(defn parse-path-content
|
|
||||||
[^js content]
|
|
||||||
(when (some? content)
|
|
||||||
(into [] (map parse-command) content)))
|
|
||||||
|
|
||||||
;; export interface Dissolve {
|
;; export interface Dissolve {
|
||||||
;; type: 'dissolve';
|
;; type: 'dissolve';
|
||||||
;; duration: number;
|
;; duration: number;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
[app.common.record :as crc]
|
[app.common.record :as crc]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.svg.path.legacy-parser2 :as spp]
|
[app.common.svg.path :as path]
|
||||||
[app.common.text :as txt]
|
[app.common.text :as txt]
|
||||||
[app.common.types.component :as ctk]
|
[app.common.types.component :as ctk]
|
||||||
[app.common.types.container :as ctn]
|
[app.common.types.container :as ctn]
|
||||||
|
@ -1296,12 +1296,10 @@
|
||||||
(cond-> (or (cfh/path-shape? data) (cfh/bool-shape? data))
|
(cond-> (or (cfh/path-shape? data) (cfh/bool-shape? data))
|
||||||
(crc/add-properties!
|
(crc/add-properties!
|
||||||
{:name "content"
|
{:name "content"
|
||||||
:get #(-> % u/proxy->shape :content format/format-path-content)
|
:get #(-> % u/proxy->shape :content upf/format-path)
|
||||||
:set
|
:set
|
||||||
(fn [_ value]
|
(fn [_ value]
|
||||||
(let [content
|
(let [content (->> (path/parse value))]
|
||||||
(->> (parser/parse-path-content value)
|
|
||||||
(spp/simplify-commands))]
|
|
||||||
(cond
|
(cond
|
||||||
(not (cfh/path-shape? data))
|
(not (cfh/path-shape? data))
|
||||||
(u/display-not-valid :content-type type)
|
(u/display-not-valid :content-type type)
|
||||||
|
|
Loading…
Reference in a new issue