diff --git a/common/src/app/common/geom/shapes/path.cljc b/common/src/app/common/geom/shapes/path.cljc index ed6724904..d8bd67cfc 100644 --- a/common/src/app/common/geom/shapes/path.cljc +++ b/common/src/app/common/geom/shapes/path.cljc @@ -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