/
SVGGraphicsElement.cljs
55 lines (42 loc) · 1.57 KB
/
SVGGraphicsElement.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(ns web.svg.SVGGraphicsElement
"The SVGGraphicsElement interface represents SVG elements whose
purpose is to directly render graphics into a group."
(:refer-clojure :exclude []))
(defn get-b-box
"Method.
The SVGGraphicsElement.getBBox() allows us to determine the coordinates
the smallest rectangle in which the object fits. The coordinates
are with respect to the current svg space, i.e. after the application
all geometry attributes on all the elements contained in the
element.
`let bboxRect = object.getBBox();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox`"
[this ]
(-> this (.getBBox)))
(defn get-ctm
"Method.
Returns a DOMMatrix representing the matrix that transforms the
element's coordinate system to its SVG viewport's coordinate"
[this & args]
(-> this .-getCTM (.apply this (clj->js args))))
(defn get-screen-ctm
"Method.
Returns a DOMMatrix representing the matrix that transforms the
element's coordinate system to the coordinate system of the SVG
for the SVG document fragment."
[this & args]
(-> this .-getScreenCTM (.apply this (clj->js args))))
(defn transform
"Property.
An SVGAnimatedTransformList reflecting the computed value of
transform property and its corresponding transform attribute
the given element."
[this]
(-> this (.-transform)))
(defn set-transform!
"Property.
An SVGAnimatedTransformList reflecting the computed value of
transform property and its corresponding transform attribute
the given element."
[this val]
(aset this "transform" val))