Commit 60fa8cbc by Dmitry Baranovskiy

Add plug-ins functionality.

parent e0824dd2
......@@ -659,6 +659,11 @@
container[prop] = R._.paper[prop];
}
}
for (var prop in R.fn) {
if (!container[prop]) {
container[prop] = R.fn[prop];
}
}
container.clear();
return container;
};
......
......@@ -698,29 +698,7 @@
return res;
};
R._.theGroup = function (vml) {
var el = document.createElement("rvml:group"), els = el.style;
els.position = "absolute";
els.left = 0;
els.top = 0;
els.width = vml.width;
els.height = vml.height;
if (vml.canvas) {
vml.canvas.appendChild(el);
}
var res = new Element(el, el, vml);
for (var f in vml) {
if (f.charAt(0) != "_" && typeof vml[f] == "function") {
res[f] = (function (f) {
return function () {
var e = vml[f].apply(vml, arguments);
el.appendChild(e[0].parentNode);
return e;
};
})(f);
}
}
res.type = "group";
return res;
return this;
};
R._create = function () {
// container, width, height
......@@ -803,6 +781,11 @@
for (var prop in R._.paper) {
container[prop] = R._.paper[prop];
}
for (var prop in R.fn) {
if (!container[prop]) {
container[prop] = R.fn[prop];
}
}
container.clear = function () {
var todel = [];
for (var i = 0, ii = r.childNodes.length; i < ii; i++) {
......
......@@ -16,6 +16,7 @@ function Raphael() {
paper: {},
element: {}
};
R.fn = {};
var availableAttrs = {cx: 0, cy: 0, fill: "#fff", "fill-opacity": 1, font: '16px "Arial"', "font-family": '"Arial"', "font-size": "16", gradient: 0, height: 0, opacity: 1, path: "M0,0", r: 0, rotation: 0, rx: 0, ry: 0, scale: "1 1", stroke: "#000", "stroke-dasharray": "", "stroke-linecap": "butt", "stroke-linejoin": "butt", "stroke-miterlimit": 0, "stroke-opacity": 1, "stroke-width": 1, translation: "0 0", width: 0, x: 0, y: 0},
availableAnimAttrs = {cx: "number", cy: "number", fill: "colour", "fill-opacity": "number", "font-size": "number", height: "number", opacity: "number", path: "path", r: "number", rotation: "number", rx: "number", ry: "number", scale: "csv", stroke: "colour", "stroke-opacity": "number", "stroke-width": "number", translation: "csv", width: "number", x: "number", y: "number"};
R._.paper.circle = function (x, y, r) {
......@@ -738,7 +739,9 @@ function Raphael() {
var script = document.getElementsByTagName("script"),
newscript = document.createElement("script");
script = script[script.length - 1];
var path = script.src.match(/.*\//);
path = path ? path[0] : "";
newscript.type = "text/javascript";
newscript.src = window.SVGAngle ? "raphael-svg.js" : "raphael-vml.js";
newscript.src = path + (window.SVGAngle ? "raphael-svg.js" : "raphael-vml.js");
script.parentNode.appendChild(newscript);
})(Raphael);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment