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

View file

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

View file

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

View file

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

View file

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

View file

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