0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 08:11:30 -05:00

Rename missing "-" prefixed api on shapes.

This commit is contained in:
Andrey Antukh 2016-02-27 14:58:10 +02:00
parent 4cb0aa00fb
commit 91551044d0
6 changed files with 13 additions and 13 deletions

View file

@ -72,7 +72,7 @@
dispatch-by-type
:hierarchy #'+hierarchy+)
(defmulti -transformation
(defmulti transformation
dispatch-by-type
:hierarchy #'+hierarchy+)
@ -281,7 +281,7 @@
[shape _]
(throw (ex-info "Not implemented (outer-rect')" (select-keys shape [:type]))))
(defmethod -transformation :builtin/icon
(defmethod transformation :builtin/icon
[{:keys [x1 y1 rotation view-box] :or {rotation 0} :as shape}]
(let [{:keys [width height]} (size shape)
orig-width (nth view-box 2)
@ -297,7 +297,7 @@
(gmt/translate (- center-x) (- center-y))
(gmt/scale scale-x scale-y))))
(defmethod -transformation :builtin/rect
(defmethod transformation :builtin/rect
[{:keys [x1 y1 rotation] :or {rotation 0} :as shape}]
(let [{:keys [width height]} (size shape)
center-x (+ x1 (/ width 2))
@ -308,7 +308,7 @@
(gmt/translate (- center-x) (- center-y)))))
(defmethod -transformation :builtin/text
(defmethod transformation :builtin/text
[{:keys [x1 y1 rotation] :or {rotation 0} :as shape}]
(let [{:keys [width height]} (size shape)
center-x (+ x1 (/ width 2))
@ -319,7 +319,7 @@
(gmt/translate (- center-x) (- center-y)))))
(defmethod -transformation :builtin/circle
(defmethod transformation :builtin/circle
[{:keys [cx cy rx ry rotation] :or {rotation 0} :as shape}]
(-> (gmt/matrix)
(gmt/translate cx cy)
@ -328,7 +328,7 @@
(declare outer-rect)
(defmethod -transformation :builtin/group
(defmethod transformation :builtin/group
[{:keys [dx dy rotation items] :or {rotation 0} :as shape}]
(let [shapes-by-id (get @st/state :shapes-by-id)
shapes (map #(get shapes-by-id %) items)
@ -341,9 +341,9 @@
(gmt/rotate rotation)
(gmt/translate (- center-x) (- center-y)))))
(defmethod -transformation :default
(defmethod transformation :default
[shape _]
(throw (ex-info "Not implemented (-transformation)" (select-keys shape [:type]))))
(throw (ex-info "Not implemented (transformation)" (select-keys shape [:type]))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Helpers

View file

@ -15,7 +15,7 @@
(defmethod uusc/render-shape :builtin/circle
[{:keys [id] :as shape}]
(let [key (str id)
rfm (ush/-transformation shape)
rfm (ush/transformation shape)
props (select-keys shape [:cx :cy :rx :ry])
attrs (-> (uusc/extract-style-attrs shape)
(merge {:id key :key key :transform (str rfm)})

View file

@ -15,7 +15,7 @@
(defmethod uusc/render-shape :builtin/group
[{:keys [items id dx dy rotation] :as shape} factory]
(let [key (str "group-" id)
rfm (ush/-transformation shape)
rfm (ush/transformation shape)
attrs (merge {:id key :key key :transform (str rfm)}
(uusc/extract-style-attrs shape)
(uusc/make-debug-attrs shape))

View file

@ -117,7 +117,7 @@
(defmethod uusc/render-shape :builtin/icon
[{:keys [data id] :as shape} _]
(let [key (str id)
rfm (sh/-transformation shape)
rfm (sh/transformation shape)
attrs (merge {:id key :key key :transform (str rfm)}
(uusc/extract-style-attrs shape)
(uusc/make-debug-attrs shape))]

View file

@ -15,7 +15,7 @@
(defmethod uusc/render-shape :builtin/rect
[{:keys [id x1 y1 x2 y2] :as shape}]
(let [key (str id)
rfm (ush/-transformation shape)
rfm (ush/transformation shape)
size (ush/size shape)
props {:x x1 :y y1 :id key :key key :transform (str rfm)}
attrs (-> (uusc/extract-style-attrs shape)

View file

@ -135,7 +135,7 @@
(defmethod uusc/render-shape :builtin/text
[{:keys [id x1 y1 x2 y2 content drawing? editing?] :as shape}]
(let [key (str id)
rfm (ush/-transformation shape)
rfm (ush/transformation shape)
size (ush/size shape)
props {:x x1 :y y1
:transform (str rfm)}