// ┌─────────────────────────────────────────────────────────────────────┐ \\
-// │ Raphaël 2 - JavaScript Vector Library │ \\
+// │ Raphaël - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ VML Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
R.toString = function () {
return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
};
- addArrow = function (o, value, isEnd) {
+ var addArrow = function (o, value, isEnd) {
var values = Str(value).toLowerCase().split("-"),
se = isEnd ? "end" : "start",
i = values.length,
stroke[se + "arrow"] = type;
stroke[se + "arrowlength"] = w;
stroke[se + "arrowwidth"] = h;
- };
+ },
setFillAndStroke = function (o, params) {
// o.paper.canvas.style.display = "none";
o.attrs = o.attrs || {};
}
}
if (!params["clip-rect"]) {
- node.clipRect && (node.clipRect.style.clip = E);
+ node.clipRect && (node.clipRect.style.clip = "auto");
}
}
if (o.textpath) {
a["font-family"] && (s.fontFamily = a["font-family"]);
a["font-weight"] && (s.fontWeight = a["font-weight"]);
a["font-style"] && (s.fontStyle = a["font-style"]);
- fontSize = toFloat(fontSize ? fontSize[0] : a["font-size"]);
+ fontSize = toFloat(a["font-size"] || fontSize && fontSize[0]) || 10;
s.fontSize = fontSize * m + "px";
res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, "<br>"));
var brect = span.getBoundingClientRect();
res.textpath.style["v-text-kern"] = true;
}
// res.paper.canvas.style.display = E;
- };
+ },
addGradientFill = function (o, gradient, fill) {
o.attrs = o.attrs || {};
var attrs = o.attrs,
+ pow = Math.pow,
opacity,
oindex,
type = "linear",
o.appendChild(fill);
}
return 1;
- };
+ },
Element = function (node, vml) {
this[0] = this.node = node;
node.raphael = true;
if (this.removed) {
return {};
}
- if (this.type == "text") {
- return {
- x: this.X + (this.bbx || 0) - this.W / 2,
- y: this.Y - this.H,
- width: this.W,
- height: this.H
- };
- } else {
- return pathDimensions(this.attrs.path);
- }
+ return {
+ x: this.X + (this.bbx || 0) - this.W / 2,
+ y: this.Y - this.H,
+ width: this.W,
+ height: this.H
+ };
};
elproto.remove = function () {
if (this.removed) {
return;
}
+ this.paper.__set__ && this.paper.__set__.exclude(this);
R.eve.unbind("*.*." + this.id);
R._tear(this, this.paper);
this.node.parentNode.removeChild(this.node);
this.shape && this.shape.parentNode.removeChild(this.shape);
for (var i in this) {
- delete this[i];
+ this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
}
this.removed = true;
};
}
value == null && R.is(name, "object") && (params = name);
for (var key in params) {
- R.eve("attr." + key + "." + this.id, this, params[key]);
+ eve("attr." + key + "." + this.id, this, params[key]);
}
if (params) {
for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
- var par = this.paper.customAttributes[key].apply(this, [][concat](params[key]));
+ var par = this.paper.customAttributes[key].apply(this, [].concat(params[key]));
this.attrs[key] = params[key];
for (var subkey in par) if (par[has](subkey)) {
params[subkey] = par[subkey];
path.textpathok = true;
o.string = Str(text);
o.on = true;
- el.style.cssText = "position:absolute;left:0;top:0;width:1px;height:1px";
+ el.style.cssText = cssDot;
el.coordsize = zoom + S + zoom;
el.coordorigin = "0 0";
var p = new Element(el, vml),
cs.height = height;
cs.clip = "rect(0 " + width + " " + height + " 0)";
if (this._viewBox) {
- setViewBox.apply(this, this._viewBox);
+ R._engine.setViewBox.apply(this, this._viewBox);
}
return this;
};
});
return this;
};
- var createNode,
- initWin = function (win) {
+ var createNode;
+ R._engine.initWin = function (win) {
var doc = win.document;
doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
try {
};
}
};
- initWin(R._g.win);
+ R._engine.initWin(R._g.win);
R._engine.create = function () {
var con = R._getContainer.apply(0, arguments),
container = con.container,
R.eve("remove", this);
this.canvas.parentNode.removeChild(this.canvas);
for (var i in this) {
- this[i] = removed(i);
+ this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
}
return true;
};
+
+ var setproto = R.st;
+ for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
+ setproto[method] = (function (methodname) {
+ return function () {
+ var arg = arguments;
+ return this.forEach(function (el) {
+ el[methodname].apply(el, arg);
+ });
+ };
+ })(method);
+ }
}(window.Raphael);
\ No newline at end of file