mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Fix error with empty curves
This commit is contained in:
parent
2c6513ac85
commit
107d607d37
2 changed files with 21 additions and 15 deletions
|
@ -49,7 +49,8 @@
|
||||||
|
|
||||||
(let [objects (wsh/lookup-page-objects state)
|
(let [objects (wsh/lookup-page-objects state)
|
||||||
content (get-in state [:workspace-drawing :object :content] [])
|
content (get-in state [:workspace-drawing :object :content] [])
|
||||||
position (gpt/point (get-in content [0 :params] nil))
|
start (get-in content [0 :params] nil)
|
||||||
|
position (when start (gpt/point start))
|
||||||
frame-id (ctst/top-nested-frame objects position)
|
frame-id (ctst/top-nested-frame objects position)
|
||||||
flex-layout? (ctl/flex-layout? objects frame-id)
|
flex-layout? (ctl/flex-layout? objects frame-id)
|
||||||
drop-index (when flex-layout? (gsl/get-drop-index frame-id objects position))]
|
drop-index (when flex-layout? (gsl/get-drop-index frame-id objects position))]
|
||||||
|
|
|
@ -112,20 +112,25 @@
|
||||||
(update command :params assoc :x x :y y))
|
(update command :params assoc :x x :y y))
|
||||||
|
|
||||||
(defn format-path [content]
|
(defn format-path [content]
|
||||||
(let [result (make-array (count content))]
|
(try
|
||||||
(reduce (fn [last-move current]
|
(let [result (make-array (count content))]
|
||||||
(let [point (upc/command->point current)
|
(reduce (fn [last-move current]
|
||||||
current-move? (= :move-to (:command current))
|
(let [point (upc/command->point current)
|
||||||
last-move (if current-move? point last-move)]
|
current-move? (= :move-to (:command current))
|
||||||
|
last-move (if current-move? point last-move)]
|
||||||
|
|
||||||
(if (and (not current-move?) (pt= last-move point))
|
(if (and (not current-move?) (pt= last-move point))
|
||||||
(arr/conj! result (command->string (set-point current last-move)))
|
(arr/conj! result (command->string (set-point current last-move)))
|
||||||
(arr/conj! result (command->string current)))
|
(arr/conj! result (command->string current)))
|
||||||
|
|
||||||
(when (and (not current-move?) (pt= last-move point))
|
(when (and (not current-move?) (pt= last-move point))
|
||||||
(arr/conj! result "Z"))
|
(arr/conj! result "Z"))
|
||||||
|
|
||||||
last-move))
|
last-move))
|
||||||
nil
|
nil
|
||||||
content)
|
content)
|
||||||
(.join ^js result "")))
|
(.join ^js result ""))
|
||||||
|
|
||||||
|
(catch :default err
|
||||||
|
(.error js/console err)
|
||||||
|
nil)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue