|
42 | 42 | (defmethod properties :default [])
|
43 | 43 |
|
44 | 44 | ;; Element multimethods.
|
45 |
| -(defmulti render :tag) |
46 |
| -(defmulti render-to-string :tag) |
47 |
| -(defmulti path :tag) |
48 |
| -(defmulti area :tag) |
49 |
| -(defmulti centroid :tag) |
50 |
| -(defmulti snapping-points :tag) |
51 |
| -(defmulti render-edit :tag) |
52 |
| -(defmulti bounds (fn [el _elements] (:tag el))) ; REVIEW |
53 |
| -(defmulti translate (fn [el _offset] (:tag el))) |
54 |
| -(defmulti position (fn [el _position] (:tag el))) |
55 |
| -(defmulti scale (fn [el _ration _pivot-point] (:tag el))) |
56 |
| -(defmulti edit (fn [el _offset _handle] (:tag el))) |
| 45 | +;; The context of the element methods should be limited to the element. |
| 46 | +;; Additional arguments should not include the global db. |
| 47 | +(defmulti render "Renders the element to dom." :tag) |
| 48 | +(defmulti render-to-string "Returns an SVG string of the element." :tag) |
| 49 | +(defmulti path "Converts the elemnt to path commands (d)." :tag) |
| 50 | +(defmulti area "Calculates the area enclosed by the shape." :tag) |
| 51 | +(defmulti centroid "Returns the elements' center of mass." :tag) |
| 52 | +(defmulti snapping-points "Returns additional snapping point for the element." :tag) |
| 53 | +(defmulti render-edit "Renders the edit overlay of the element." :tag) |
| 54 | +;; REVIEW: Is there a way to avoid passing all elelemts? |
| 55 | +(defmulti bounds "Returns the local bounds of the element." (fn [el _elements] (:tag el))) |
| 56 | +(defmulti translate "Translates the element by a given offset." (fn [el _offset] (:tag el))) |
| 57 | +(defmulti position "Moves the element to a given global position." (fn [el _position] (:tag el))) |
| 58 | +(defmulti scale "Scales the element by a given ratio and pivot-point." (fn [el _ration _pivot-point] (:tag el))) |
| 59 | +(defmulti edit "Edits the element by a given offset and handle." (fn [el _offset _handle] (:tag el))) |
57 | 60 |
|
58 | 61 | (defmethod render :default [])
|
59 | 62 | (defmethod render-to-string :default [element] [render element])
|
|
0 commit comments