mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 09:21:39 +02:00
♻️ Moved main.geom to util.geom.shapes
This commit is contained in:
parent
e6855fd9b3
commit
b0318d3144
18 changed files with 26 additions and 26 deletions
|
@ -25,7 +25,7 @@
|
|||
[uxbox.main.data.dashboard :as dd]
|
||||
[uxbox.main.data.helpers :as helpers]
|
||||
[uxbox.main.data.icons :as udi]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.repo :as rp]
|
||||
[uxbox.main.store :as st]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]
|
||||
[uxbox.main.worker :as uw]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.common.data :as d]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.pages :as cp]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.streams :as ms]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as gsh]
|
||||
[uxbox.util.geom.point :as gpt]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.main.data.helpers :as helpers]
|
||||
|
@ -89,7 +89,7 @@
|
|||
|
||||
;; Resize origin point given the selected handler
|
||||
origin (-> (handler-resize-origin shape handler)
|
||||
(geom/transform-shape-point shape shape-transform))]
|
||||
(gsh/transform-shape-point shape shape-transform))]
|
||||
|
||||
(rx/of (set-modifiers ids {:resize-vector scalev
|
||||
:resize-origin origin
|
||||
|
@ -114,7 +114,7 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [initial (apply-zoom @ms/mouse-position)
|
||||
shape (geom/shape->rect-shape shape)
|
||||
shape (gsh/shape->rect-shape shape)
|
||||
stoper (rx/filter ms/mouse-up? stream)]
|
||||
(rx/concat
|
||||
(->> ms/mouse-position
|
||||
|
@ -134,7 +134,7 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [stoper (rx/filter ms/mouse-up? stream)
|
||||
group (geom/selection-rect shapes)
|
||||
group (gsh/selection-rect shapes)
|
||||
group-center (gpt/center group)
|
||||
initial-angle (gpt/angle (apply-zoom @ms/mouse-position) group-center)
|
||||
calculate-angle (fn [pos ctrl?]
|
||||
|
@ -216,7 +216,7 @@
|
|||
selected (get-in state [:workspace-local :selected])
|
||||
options (get-in state [:workspace-data pid :options])
|
||||
shapes (map #(get-in state [:workspace-data pid :objects %]) selected)
|
||||
shape (geom/shapes->rect-shape shapes)
|
||||
shape (gsh/shapes->rect-shape shapes)
|
||||
displacement (if align?
|
||||
(get-displacement-with-grid shape direction options)
|
||||
(get-displacement shape direction))]
|
||||
|
@ -258,7 +258,7 @@
|
|||
(update [_ state]
|
||||
(let [page-id (:current-page-id state)]
|
||||
(letfn [(calculate-displacement [shape angle center]
|
||||
(let [shape-center (geom/center shape)]
|
||||
(let [shape-center (gsh/center shape)]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/rotate angle center)
|
||||
(gmt/rotate (- angle) shape-center))))
|
||||
|
@ -275,7 +275,7 @@
|
|||
(rotate-around-center [state angle center shapes]
|
||||
(reduce #(rotate-shape %1 angle %2 center) state shapes))]
|
||||
|
||||
(let [center (-> shapes geom/selection-rect gpt/center)
|
||||
(let [center (-> shapes gsh/selection-rect gpt/center)
|
||||
objects (get-in state [:workspace-data page-id :objects])
|
||||
id->obj #(get objects %)
|
||||
get-children (fn [shape] (map id->obj (helpers/get-children (:id shape) objects)))
|
||||
|
@ -300,7 +300,7 @@
|
|||
;; For each shape applies the modifiers by transforming the objects
|
||||
update-shape
|
||||
(fn [state shape-id]
|
||||
(update-in state [:workspace-data page-id :objects shape-id] geom/transform-shape))]
|
||||
(update-in state [:workspace-data page-id :objects shape-id] gsh/transform-shape))]
|
||||
|
||||
(reduce update-shape state ids-with-children)))
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[rumext.alpha :as mf]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.util.math :as mth]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.util.geom.point :as gpt]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.main.ui.shapes.frame :as frame]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.util.debug :as debug]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.util.geom.point :as gpt]
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
(ns uxbox.main.ui.shapes.circle
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
[uxbox.main.ui.shapes.common :as common]
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.keyboard :as kbd]
|
||||
[uxbox.main.streams :as uws]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.util.geom.point :as gpt]
|
||||
[uxbox.util.dom :as dom]))
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
[uxbox.common.data :as d]
|
||||
[uxbox.main.constants :as c]
|
||||
[uxbox.main.data.workspace :as dw]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
(:require
|
||||
[cuerdas.core :as str]
|
||||
[rumext.alpha :as mf]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.util.dom :as dom]
|
||||
[uxbox.util.interop :as itr]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
[uxbox.main.ui.shapes.common :as common]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[rumext.alpha :as mf]
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.main.data.images :as udi]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[cuerdas.core :as str :include-macros true]
|
||||
[rumext.alpha :as mf]
|
||||
[uxbox.main.data.workspace :as dw]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[cuerdas.core :as str]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.util.geom.point :as gpt]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
[uxbox.main.ui.shapes.common :as common]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
[lentes.core :as l]
|
||||
[rumext.alpha :as mf]
|
||||
[uxbox.main.data.workspace :as dw]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.shapes.common :as common]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
[rumext.alpha :as mf]
|
||||
[uxbox.main.constants :as c]
|
||||
[uxbox.main.data.workspace :as dw]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.streams :as ms]
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
[potok.core :as ptk]
|
||||
[rumext.alpha :as mf]
|
||||
[uxbox.main.data.workspace :as dw]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.streams :as ms]
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.main.geom
|
||||
(ns uxbox.util.geom.shapes
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.spec :as us]
|
|
@ -17,8 +17,8 @@
|
|||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.main.geom :as geom]
|
||||
[uxbox.worker.impl :as impl]
|
||||
[uxbox.util.geom.shapes :as geom]
|
||||
[uxbox.util.quadtree :as qdt]))
|
||||
|
||||
(defonce state (l/atom {}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue