mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
🐛 Fix problem with mix between open/closed and line/curves
This commit is contained in:
parent
2833d3126f
commit
d2d506dbf0
1 changed files with 15 additions and 18 deletions
|
@ -126,8 +126,8 @@
|
|||
|
||||
(let [tangent (curve-tangent curve t)]
|
||||
(cond
|
||||
(> (:y tangent) 0) 1
|
||||
(< (:y tangent) 0) -1
|
||||
(> (:y tangent) 0) -1
|
||||
(< (:y tangent) 0) 1
|
||||
:else 0)))
|
||||
|
||||
(defn curve-split
|
||||
|
@ -822,30 +822,27 @@
|
|||
(let [selrect (content->selrect content)
|
||||
ray-line [point (gpt/point (inc (:x point)) (:y point))]
|
||||
|
||||
closed-subpaths
|
||||
(->> content
|
||||
(sp/close-subpaths)
|
||||
(sp/get-subpaths)
|
||||
(filterv sp/is-closed?))
|
||||
closed-content
|
||||
(into []
|
||||
(comp (filter sp/is-closed?)
|
||||
(mapcat :data))
|
||||
(->> content
|
||||
(sp/close-subpaths)
|
||||
(sp/get-subpaths)))
|
||||
|
||||
cast-ray
|
||||
(fn [cmd]
|
||||
(case (:command cmd)
|
||||
:line-to (ray-line-intersect point (command->line cmd))
|
||||
:curve-to (ray-curve-intersect ray-line (command->bezier cmd))
|
||||
#_:else []))
|
||||
|
||||
is-point-in-subpath?
|
||||
(fn [subpath]
|
||||
(and (gpr/contains-point? (content->selrect (:data subpath)) point)
|
||||
(->> (:data subpath)
|
||||
(mapcat cast-ray)
|
||||
(map second)
|
||||
(reduce +)
|
||||
(not= 0))))]
|
||||
#_:else []))]
|
||||
|
||||
(and (gpr/contains-point? selrect point)
|
||||
(some is-point-in-subpath? closed-subpaths))))
|
||||
(->> closed-content
|
||||
(mapcat cast-ray)
|
||||
(map second)
|
||||
(reduce +)
|
||||
(not= 0)))))
|
||||
|
||||
(defn split-line-to
|
||||
"Given a point and a line-to command will create a two new line-to commands
|
||||
|
|
Loading…
Add table
Reference in a new issue