summaryrefslogtreecommitdiffstats
path: root/src/pointed.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-06-28 18:39:11 +0200
committerwout <wout@impinc.co.uk>2014-06-28 18:39:11 +0200
commit2260f5789b48dd92dccf0dd734cf59cf957e4d52 (patch)
tree2c94e66afe60e45f34db6ced5f24069ab4466c72 /src/pointed.js
parent0d11ad263f193e8a585e7676deb8a60a8c103ef6 (diff)
downloadsvg.js-2260f5789b48dd92dccf0dd734cf59cf957e4d52.tar.gz
svg.js-2260f5789b48dd92dccf0dd734cf59cf957e4d52.zip
Added new SVG.Line class and working on SVG.Matrix
Diffstat (limited to 'src/pointed.js')
-rw-r--r--src/pointed.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pointed.js b/src/pointed.js
new file mode 100644
index 0000000..02ff44e
--- /dev/null
+++ b/src/pointed.js
@@ -0,0 +1,25 @@
+// unify all point to point elements
+SVG.extend(SVG.Line, SVG.Polyline, SVG.Polygon, {
+ // Define morphable array
+ morphArray: SVG.PointArray
+ // Move by left top corner over x-axis
+, x: function(x) {
+ return x == null ? this.bbox().x : this.move(x, this.bbox().y)
+ }
+ // Move by left top corner over y-axis
+, y: function(y) {
+ return y == null ? this.bbox().y : this.move(this.bbox().x, y)
+ }
+ // Set width of element
+, width: function(width) {
+ var b = this.bbox()
+
+ return width == null ? b.width : this.size(width, b.height)
+ }
+ // Set height of element
+, height: function(height) {
+ var b = this.bbox()
+
+ return height == null ? b.height : this.size(b.width, height)
+ }
+}) \ No newline at end of file