1 Raphael.el.isAbsolute = true;
2 Raphael.el.absolutely = function () {
3 if (this.type != "path") {
6 this.isAbsolute = true;
9 Raphael.el.relatively = function () {
10 if (this.type != "path") {
13 this.isAbsolute = false;
16 Raphael.el.moveTo = function (x, y) {
17 if (this.type != "path") {
20 var d = this.isAbsolute ? "M" : "m";
21 d += +parseFloat(x).toFixed(3) + " " + (+parseFloat(y).toFixed(3)) + " ";
22 this.attr({path: this.attrs.path + d});
25 Raphael.el.lineTo = function (x, y) {
26 if (this.type != "path") {
29 var d = this.isAbsolute ? "L" : "l";
30 d += +parseFloat(x).toFixed(3) + " " + (+parseFloat(y).toFixed(3)) + " ";
31 this.attr({path: this.attrs.path + d});
34 Raphael.el.arcTo = function (rx, ry, large_arc_flag, sweep_flag, x, y) {
35 if (this.type != "path") {
38 var d = this.isAbsolute ? "A" : "a";
39 d += [+parseFloat(rx).toFixed(3), +parseFloat(ry).toFixed(3), 0, large_arc_flag, sweep_flag, +parseFloat(x).toFixed(3), +parseFloat(y).toFixed(3)].join(" ");
40 this.attr({path: this.attrs.path + d});
43 Raphael.el.curveTo = function () {
44 if (this.type != "path") {
47 var args = Array.prototype.splice.call(arguments, 0, arguments.length),
48 d = [0, 0, 0, 0, "s", 0, "c"][args.length] || "";
49 if (this.isAbsolute) {
52 this.attr({path: this.attrs.path + d + args});
55 Raphael.el.qcurveTo = function () {
56 if (this.type != "path") {
59 var d = [0, 1, "t", 3, "q"][arguments.length],
60 args = Array.prototype.splice.call(arguments, 0, arguments.length);
61 if (this.isAbsolute) {
64 this.attr({path: this.attrs.path + d + args});
67 Raphael.el.addRoundedCorner = function (r, dir) {
68 if (this.type != "path") {
71 var rollback = this.isAbsolute,
75 rollback = function () {
79 rollback = function () {};
81 this.arcTo(r, r, 0, {"lu": 1, "rd": 1, "ur": 1, "dl": 1}[dir] || 0, r * (!!(dir.indexOf("r") + 1) * 2 - 1), r * (!!(dir.indexOf("d") + 1) * 2 - 1));
85 Raphael.el.andClose = function () {
86 if (this.type != "path") {
89 this.attr({path: this.attrs.path + "z"});