mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -05:00
Remove unused code from geom ns.
This commit is contained in:
parent
747c07af00
commit
f7f05c4dbb
1 changed files with 0 additions and 94 deletions
|
@ -746,100 +746,6 @@
|
|||
:x x
|
||||
:y y}))
|
||||
|
||||
;; --- Transformation Matrix
|
||||
|
||||
(declare transformation-matrix-rect)
|
||||
(declare transformation-matrix-text)
|
||||
(declare transformation-matrix-circle)
|
||||
(declare transformation-matrix-icon)
|
||||
(declare transformation-matrix-path)
|
||||
(declare transformation-matrix-group)
|
||||
|
||||
(defn transformation-matrix
|
||||
([shape]
|
||||
(transformation-matrix @st/state shape))
|
||||
([state shape]
|
||||
(case (:type shape)
|
||||
:rect (transformation-matrix-rect state shape)
|
||||
:text (transformation-matrix-text state shape)
|
||||
:circle (transformation-matrix-circle state shape)
|
||||
:icon (transformation-matrix-icon state shape)
|
||||
:image (transformation-matrix-icon state shape)
|
||||
:path (transformation-matrix-path state shape)
|
||||
:group (transformation-matrix-group state shape))))
|
||||
|
||||
(defn- transformation-matrix-rect
|
||||
[state {:keys [x1 y1 rotation] :or {rotation 0} :as shape}]
|
||||
(let [{:keys [width height]} (size shape)
|
||||
center-x (+ x1 (/ width 2))
|
||||
center-y (+ y1 (/ height 2))]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/translate center-x center-y)
|
||||
(gmt/rotate rotation)
|
||||
(gmt/translate (- center-x) (- center-y)))))
|
||||
|
||||
(defn- transformation-matrix-text
|
||||
[state {:keys [x1 y1 rotation] :or {rotation 0} :as shape}]
|
||||
(let [{:keys [width height]} (size shape)
|
||||
center-x (+ x1 (/ width 2))
|
||||
center-y (+ y1 (/ height 2))]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/translate center-x center-y)
|
||||
(gmt/rotate rotation)
|
||||
(gmt/translate (- center-x) (- center-y)))))
|
||||
|
||||
(defn- transformation-matrix-icon
|
||||
[state {:keys [x1 y1 rotation view-box] :or {rotation 0} :as shape}]
|
||||
(let [{:keys [width height]} (size shape)
|
||||
orig-width (nth view-box 2)
|
||||
orig-height (nth view-box 3)
|
||||
scale-x (/ width orig-width)
|
||||
scale-y (/ height orig-height)
|
||||
center-x (- width (/ width 2))
|
||||
center-y (- height (/ height 2))]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/translate x1 y1)
|
||||
(gmt/translate center-x center-y)
|
||||
(gmt/rotate rotation)
|
||||
(gmt/translate (- center-x) (- center-y))
|
||||
(gmt/scale scale-x scale-y))))
|
||||
|
||||
(defn- transformation-matrix-path
|
||||
[state {:keys [x1 y1 rotation view-box] :or {rotation 0} :as shape}]
|
||||
(let [{:keys [width height]} (size shape)
|
||||
orig-width (nth view-box 2)
|
||||
orig-height (nth view-box 3)
|
||||
scale-x (/ width orig-width)
|
||||
scale-y (/ height orig-height)
|
||||
center-x (- width (/ width 2))
|
||||
center-y (- height (/ height 2))]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/translate x1 y1)
|
||||
(gmt/translate center-x center-y)
|
||||
(gmt/rotate rotation)
|
||||
(gmt/translate (- center-x) (- center-y))
|
||||
(gmt/scale scale-x scale-y))))
|
||||
|
||||
(defn- transformation-matrix-circle
|
||||
[state {:keys [cx cy rx ry rotation] :or {rotation 0} :as shape}]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/translate cx cy)
|
||||
(gmt/rotate rotation)
|
||||
(gmt/translate (- cx) (- cy))))
|
||||
|
||||
(defn- transformation-matrix-group
|
||||
[state {:keys [dx dy rotation items] :or {rotation 0} :as shape}]
|
||||
(let [shapes-by-id (get state :shapes)
|
||||
shapes (map #(get shapes-by-id %) items)
|
||||
{:keys [x y width height]} (outer-rect-coll shapes)
|
||||
center-x (+ x (/ width 2))
|
||||
center-y (+ y (/ height 2))]
|
||||
(-> (gmt/matrix)
|
||||
(gmt/translate (or dx 0) (or dy 0))
|
||||
(gmt/translate center-x center-y)
|
||||
(gmt/rotate rotation)
|
||||
(gmt/translate (- center-x) (- center-y)))))
|
||||
|
||||
;; --- Helpers
|
||||
|
||||
(defn apply-rotation
|
||||
|
|
Loading…
Add table
Reference in a new issue