mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 15:47:12 +02:00
✨ Replace duplicate fn get-point with segment->point
This commit is contained in:
parent
f3c3f3e2d8
commit
1d0020f6e6
7 changed files with 46 additions and 49 deletions
|
@ -76,7 +76,7 @@
|
|||
|
||||
index (or index (count content))
|
||||
prefix (or prefix :c1)
|
||||
position (or position (path.segment/get-point (nth content (dec index))))
|
||||
position (or position (path.helpers/segment->point (nth content (dec index))))
|
||||
|
||||
old-handler (path.segment/handler->point content index prefix)
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@
|
|||
content (st/get-path state :content)
|
||||
points (path.segment/get-points content)
|
||||
|
||||
point (-> content (nth (if (= prefix :c1) (dec index) index)) (path.segment/get-point))
|
||||
point (-> content (nth (if (= prefix :c1) (dec index) index)) (path.helpers/segment->point))
|
||||
handler (-> content (nth index) (path.segment/get-handler prefix))
|
||||
|
||||
[op-idx op-prefix] (path.segment/opposite-index content index prefix)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.types.path :as path]
|
||||
[app.common.types.path.helpers :as path.helpers]
|
||||
[app.common.types.path.segment :as path.segment]
|
||||
[app.main.data.workspace.path :as drp]
|
||||
[app.main.snap :as snap]
|
||||
|
@ -299,7 +300,7 @@
|
|||
(mf/with-memo [content-points]
|
||||
(into #{} content-points))
|
||||
|
||||
last-p (->> content last path.segment/get-point)
|
||||
last-p (->> content last path.helpers/segment->point)
|
||||
|
||||
handlers
|
||||
(mf/with-memo [content]
|
||||
|
@ -422,7 +423,7 @@
|
|||
(let [[snap-selected snap-points]
|
||||
(cond
|
||||
(some? drag-handler) [#{drag-handler} points]
|
||||
(some? preview) [#{(path.segment/get-point preview)} points]
|
||||
(some? preview) [#{(path.helpers/segment->point preview)} points]
|
||||
(some? moving-handler) [#{moving-handler} points]
|
||||
:else
|
||||
[(->> selected-points (map base->point) (into #{}))
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
WARNING: Pending to be removed from codebase once completly unused"
|
||||
(:require
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.types.path.segment :as path.segm]
|
||||
[app.common.types.path.helpers :refer [segment->point]]
|
||||
[app.util.array :as arr]))
|
||||
|
||||
(defn pt=
|
||||
|
@ -122,7 +122,7 @@
|
|||
(try
|
||||
(let [result (make-array (count content))]
|
||||
(reduce (fn [last-move current]
|
||||
(let [point (path.segm/get-point current)
|
||||
(let [point (segment->point current)
|
||||
current-move? (= :move-to (:command current))
|
||||
last-move (if current-move? point last-move)]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue