10
(function webpackUniversalModuleDefinition(root, factory) {
11
if(typeof exports === 'object' && typeof module === 'object')
12
module.exports = factory(require("eve"));
13
else if(typeof define === 'function' && define.amd)
14
define(["eve"], factory);
15
else if(typeof exports === 'object')
16
exports["Raphael"] = factory(require("eve"));
18
root["Raphael"] = factory(root["eve"]);
19
})(window, function(__WEBPACK_EXTERNAL_MODULE_eve__) {
20
return (function(modules) {
22
var installedModules = {};
25
function __webpack_require__(moduleId) {
28
if(installedModules[moduleId]) {
29
return installedModules[moduleId].exports;
32
var module = installedModules[moduleId] = {
39
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
45
return module.exports;
50
__webpack_require__.m = modules;
53
__webpack_require__.c = installedModules;
56
__webpack_require__.d = function(exports, name, getter) {
57
if(!__webpack_require__.o(exports, name)) {
58
Object.defineProperty(exports, name, { enumerable: true, get: getter });
63
__webpack_require__.r = function(exports) {
64
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
65
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
67
Object.defineProperty(exports, '__esModule', { value: true });
75
__webpack_require__.t = function(value, mode) {
76
if(mode & 1) value = __webpack_require__(value);
77
if(mode & 8) return value;
78
if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
79
var ns = Object.create(null);
80
__webpack_require__.r(ns);
81
Object.defineProperty(ns, 'default', { enumerable: true, value: value });
82
if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
87
__webpack_require__.n = function(module) {
88
var getter = module && module.__esModule ?
89
function getDefault() { return module['default']; } :
90
function getModuleExports() { return module; };
91
__webpack_require__.d(getter, 'a', getter);
96
__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
99
__webpack_require__.p = "";
103
return __webpack_require__(__webpack_require__.s = "./dev/raphael.amd.js");
108
"./dev/raphael.amd.js":
113
(function(module, exports, __webpack_require__) {
115
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__( "./dev/raphael.core.js"), __webpack_require__( "./dev/raphael.svg.js"), __webpack_require__( "./dev/raphael.vml.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function(R) {
119
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
120
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
124
"./dev/raphael.core.js":
129
(function(module, exports, __webpack_require__) {
131
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__( "eve")], __WEBPACK_AMD_DEFINE_RESULT__ = (function(eve) {
184
if (R.is(first, "function")) {
185
return loaded ? first() : eve.on("raphael.DOMload", first);
186
} else if (R.is(first, array)) {
187
return R._engine.create[apply](R, first.splice(0, 3 + R.is(first[0], nu))).add(first);
189
var args = Array.prototype.slice.call(arguments, 0);
190
if (R.is(args[args.length - 1], "function")) {
192
return loaded ? f.call(R._engine.create[apply](R, args)) : eve.on("raphael.DOMload", function () {
193
f.call(R._engine.create[apply](R, args));
196
return R._engine.create[apply](R, arguments);
204
elements = {circle: 1, rect: 1, path: 1, ellipse: 1, text: 1, image: 1},
205
formatrg = /\{(\d+)\}/g,
207
has = "hasOwnProperty",
213
was: Object.prototype[has].call(g.win, "Raphael"),
216
Paper = function () {
249
this.ca = this.customAttributes = {};
252
appendChild = "appendChild",
256
supportsTouch = ('ontouchstart' in window) || window.TouchEvent || window.DocumentTouch && document instanceof DocumentTouch,
261
events = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[split](S),
263
mousedown: "touchstart",
264
mousemove: "touchmove",
267
lowerCase = Str.prototype.toLowerCase,
277
toString = "toString",
279
objectToString = Object.prototype.toString,
282
ISURL = R._ISURL = /^url\(['"]?(.+?)['"]?\)$/i,
283
colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,
284
isnan = {"NaN": 1, "Infinity": 1, "-Infinity": 1},
285
bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
287
setAttribute = "setAttribute",
288
toFloat = parseFloat,
290
upperCase = Str.prototype.toUpperCase,
291
availableAttrs = R._availableAttrs = {
293
"arrow-start": "none",
295
"clip-rect": "0 0 1e9 1e9",
301
font: '10px "Arial"',
302
"font-family": '"Arial"',
304
"font-style": "normal",
308
href: "http://raphaeljs.com/",
317
"stroke-dasharray": "",
318
"stroke-linecap": "butt",
319
"stroke-linejoin": "butt",
320
"stroke-miterlimit": 0,
324
"text-anchor": "middle",
332
availableAnimAttrs = R._availableAnimAttrs = {
347
"stroke-opacity": nu,
349
transform: "transform",
354
whitespace = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,
355
commaSpaces = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,
356
hsrg = {hs: 1, rg: 1},
357
p2s = /,?([achlmqrstvxz]),?/gi,
358
pathCommand = /([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,
359
tCommand = /([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,
360
pathValues = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,
361
radial_gradient = R._radial_gradient = /^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,
363
sortByKey = function (a, b) {
364
return a.key - b.key;
366
sortByNumber = function (a, b) {
367
return toFloat(a) - toFloat(b);
369
fun = function () {},
370
pipe = function (x) {
373
rectPath = R._rectPath = function (x, y, w, h, r) {
375
return [["M", x + r, y], ["l", w - r * 2, 0], ["a", r, r, 0, 0, 1, r, r], ["l", 0, h - r * 2], ["a", r, r, 0, 0, 1, -r, r], ["l", r * 2 - w, 0], ["a", r, r, 0, 0, 1, -r, -r], ["l", 0, r * 2 - h], ["a", r, r, 0, 0, 1, r, -r], ["z"]];
377
return [["M", x, y], ["l", w, 0], ["l", 0, h], ["l", -w, 0], ["z"]];
379
ellipsePath = function (x, y, rx, ry) {
383
return [["M", x, y], ["m", 0, -ry], ["a", rx, ry, 0, 1, 1, 0, 2 * ry], ["a", rx, ry, 0, 1, 1, 0, -2 * ry], ["z"]];
385
getPath = R._getPath = {
386
path: function (el) {
387
return el.attr("path");
389
circle: function (el) {
391
return ellipsePath(a.cx, a.cy, a.r);
393
ellipse: function (el) {
395
return ellipsePath(a.cx, a.cy, a.rx, a.ry);
397
rect: function (el) {
399
return rectPath(a.x, a.y, a.width, a.height, a.r);
401
image: function (el) {
403
return rectPath(a.x, a.y, a.width, a.height);
405
text: function (el) {
406
var bbox = el._getBBox();
407
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
410
var bbox = el._getBBox();
411
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
424
mapPath = R.mapPath = function (path, matrix) {
428
var x, y, i, j, ii, jj, pathi;
429
path = path2curve(path);
430
for (i = 0, ii = path.length; i < ii; i++) {
432
for (j = 1, jj = pathi.length; j < jj; j += 2) {
433
x = matrix.x(pathi[j], pathi[j + 1]);
434
y = matrix.y(pathi[j], pathi[j + 1]);
449
R.type = (g.win.SVGAngle || g.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML");
450
if (R.type == "VML") {
451
var d = g.doc.createElement("div"),
453
d.innerHTML = '<v:shape adj="1"/>';
455
b.style.behavior = "url(#default#VML)";
456
if (!(b && typeof b.adj == "object")) {
473
R.svg = !(R.vml = R.type == "VML");
501
R.fn = paperproto = Paper.prototype = R.prototype;
513
R.is = function (o, type) {
514
type = lowerCase.call(type);
515
if (type == "finite") {
516
return !isnan[has](+o);
518
if (type == "array") {
519
return o instanceof Array;
521
return (type == "null" && o === null) ||
522
(type == typeof o && o !== null) ||
523
(type == "object" && o === Object(o)) ||
524
(type == "array" && Array.isArray && Array.isArray(o)) ||
525
objectToString.call(o).slice(8, -1).toLowerCase() == type;
528
function clone(obj) {
529
if (typeof obj == "function" || Object(obj) !== obj) {
532
var res = new obj.constructor;
533
for (var key in obj) if (obj[has](key)) {
534
res[key] = clone(obj[key]);
553
R.angle = function (x1, y1, x2, y2, x3, y3) {
560
return (180 + math.atan2(-y, -x) * 180 / PI + 360) % 360;
562
return R.angle(x1, y1, x3, y3) - R.angle(x2, y2, x3, y3);
574
R.rad = function (deg) {
575
return deg % 360 * PI / 180;
586
R.deg = function (rad) {
587
return Math.round ((rad * 180 / PI% 360)* 1000) / 1000;
600
R.snapTo = function (values, value, tolerance) {
601
tolerance = R.is(tolerance, "finite") ? tolerance : 10;
602
if (R.is(values, array)) {
603
var i = values.length;
604
while (i--) if (abs(values[i] - value) <= tolerance) {
609
var rem = value % values;
610
if (rem < tolerance) {
613
if (rem > values - tolerance) {
614
return value - rem + values;
626
var createUUID = R.createUUID = (function (uuidRegEx, uuidReplacer) {
628
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(uuidRegEx, uuidReplacer).toUpperCase();
630
})(/[xy]/g, function (c) {
631
var r = math.random() * 16 | 0,
632
v = c == "x" ? r : (r & 3 | 8);
633
return v.toString(16);
644
R.setWindow = function (newwin) {
645
eve("raphael.setWindow", R, g.win, newwin);
647
g.doc = g.win.document;
648
if (R._engine.initWin) {
649
R._engine.initWin(g.win);
652
var toHex = function (color) {
655
var trim = /^\s+|\s+$/g;
658
var docum = new ActiveXObject("htmlfile");
659
docum.write("<body>");
663
bod = createPopup().document.body;
665
var range = bod.createTextRange();
666
toHex = cacher(function (color) {
668
bod.style.color = Str(color).replace(trim, E);
669
var value = range.queryCommandValue("ForeColor");
670
value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16);
671
return "#" + ("000000" + value.toString(16)).slice(-6);
677
var i = g.doc.createElement("i");
678
i.title = "Rapha\xebl Colour Picker";
679
i.style.display = "none";
680
g.doc.body.appendChild(i);
681
toHex = cacher(function (color) {
682
i.style.color = color;
683
return g.doc.defaultView.getComputedStyle(i, E).getPropertyValue("color");
688
hsbtoString = function () {
689
return "hsb(" + [this.h, this.s, this.b] + ")";
691
hsltoString = function () {
692
return "hsl(" + [this.h, this.s, this.l] + ")";
694
rgbtoString = function () {
697
prepareRGB = function (r, g, b) {
698
if (g == null && R.is(r, "object") && "r" in r && "g" in r && "b" in r) {
703
if (g == null && R.is(r, string)) {
704
var clr = R.getRGB(r);
709
if (r > 1 || g > 1 || b > 1) {
717
packageRGB = function (r, g, b, o) {
726
toString: rgbtoString
728
R.is(o, "finite") && (rgb.opacity = o);
752
R.color = function (clr) {
754
if (R.is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) {
755
rgb = R.hsb2rgb(clr);
760
} else if (R.is(clr, "object") && "h" in clr && "s" in clr && "l" in clr) {
761
rgb = R.hsl2rgb(clr);
767
if (R.is(clr, "string")) {
770
if (R.is(clr, "object") && "r" in clr && "g" in clr && "b" in clr) {
771
rgb = R.rgb2hsl(clr);
775
rgb = R.rgb2hsb(clr);
779
clr.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1;
782
clr.toString = rgbtoString;
802
R.hsb2rgb = function (h, s, v, o) {
803
if (this.is(h, "object") && "h" in h && "s" in h && "b" in h) {
813
X = C * (1 - abs(h % 2 - 1));
817
R += [C, X, 0, 0, X, C][h];
818
G += [X, C, C, X, 0, 0][h];
819
B += [0, 0, X, C, C, X][h];
820
return packageRGB(R, G, B, o);
839
R.hsl2rgb = function (h, s, l, o) {
840
if (this.is(h, "object") && "h" in h && "s" in h && "l" in h) {
845
if (h > 1 || s > 1 || l > 1) {
853
C = 2 * s * (l < .5 ? l : 1 - l);
854
X = C * (1 - abs(h % 2 - 1));
855
R = G = B = l - C / 2;
858
R += [C, X, 0, 0, X, C][h];
859
G += [X, C, C, X, 0, 0][h];
860
B += [0, 0, X, C, C, X][h];
861
return packageRGB(R, G, B, o);
879
R.rgb2hsb = function (r, g, b) {
880
b = prepareRGB(r, g, b);
887
C = V - mmin(r, g, b);
889
V == r ? (g - b) / C :
890
V == g ? (b - r) / C + 2 :
893
H = ((H + 360) % 6) * 60 / 360;
894
S = C == 0 ? 0 : C / V;
895
return {h: H, s: S, b: V, toString: hsbtoString};
913
R.rgb2hsl = function (r, g, b) {
914
b = prepareRGB(r, g, b);
919
var H, S, L, M, m, C;
924
M == r ? (g - b) / C :
925
M == g ? (b - r) / C + 2 :
927
H = ((H + 360) % 6) * 60 / 360;
930
L < .5 ? C / (2 * L) :
932
return {h: H, s: S, l: L, toString: hsltoString};
934
R._path2string = function () {
935
return this.join(",").replace(p2s, "$1");
937
function repush(array, item) {
938
for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) {
939
return array.push(array.splice(i, 1)[0]);
942
function cacher(f, scope, postprocessor) {
944
var arg = Array.prototype.slice.call(arguments, 0),
945
args = arg.join("\u2400"),
946
cache = newf.cache = newf.cache || {},
947
count = newf.count = newf.count || [];
948
if (cache[has](args)) {
950
return postprocessor ? postprocessor(cache[args]) : cache[args];
952
count.length >= 1e3 && delete cache[count.shift()];
954
cache[args] = f[apply](scope, arg);
955
return postprocessor ? postprocessor(cache[args]) : cache[args];
960
var preload = R._preload = function (src, f) {
961
var img = g.doc.createElement("img");
962
img.style.cssText = "position:absolute;left:-9999em;top:-9999em";
963
img.onload = function () {
966
g.doc.body.removeChild(this);
968
img.onerror = function () {
969
g.doc.body.removeChild(this);
971
g.doc.body.appendChild(img);
975
function clrToString() {
1006
R.getRGB = cacher(function (colour) {
1007
if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) {
1008
return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
1010
if (colour == "none") {
1011
return {r: -1, g: -1, b: -1, hex: "none", toString: clrToString};
1013
!(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour));
1021
rgb = colour.match(colourRegExp);
1024
blue = toInt(rgb[2].substring(5), 16);
1025
green = toInt(rgb[2].substring(3, 5), 16);
1026
red = toInt(rgb[2].substring(1, 3), 16);
1029
blue = toInt((t = rgb[3].charAt(3)) + t, 16);
1030
green = toInt((t = rgb[3].charAt(2)) + t, 16);
1031
red = toInt((t = rgb[3].charAt(1)) + t, 16);
1034
values = rgb[4][split](commaSpaces);
1035
red = toFloat(values[0]);
1036
values[0].slice(-1) == "%" && (red *= 2.55);
1037
green = toFloat(values[1]);
1038
values[1].slice(-1) == "%" && (green *= 2.55);
1039
blue = toFloat(values[2]);
1040
values[2].slice(-1) == "%" && (blue *= 2.55);
1041
rgb[1].toLowerCase().slice(0, 4) == "rgba" && (opacity = toFloat(values[3]));
1042
values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
1045
values = rgb[5][split](commaSpaces);
1046
red = toFloat(values[0]);
1047
values[0].slice(-1) == "%" && (red *= 2.55);
1048
green = toFloat(values[1]);
1049
values[1].slice(-1) == "%" && (green *= 2.55);
1050
blue = toFloat(values[2]);
1051
values[2].slice(-1) == "%" && (blue *= 2.55);
1052
(values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
1053
rgb[1].toLowerCase().slice(0, 4) == "hsba" && (opacity = toFloat(values[3]));
1054
values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
1055
return R.hsb2rgb(red, green, blue, opacity);
1058
values = rgb[6][split](commaSpaces);
1059
red = toFloat(values[0]);
1060
values[0].slice(-1) == "%" && (red *= 2.55);
1061
green = toFloat(values[1]);
1062
values[1].slice(-1) == "%" && (green *= 2.55);
1063
blue = toFloat(values[2]);
1064
values[2].slice(-1) == "%" && (blue *= 2.55);
1065
(values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
1066
rgb[1].toLowerCase().slice(0, 4) == "hsla" && (opacity = toFloat(values[3]));
1067
values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
1068
return R.hsl2rgb(red, green, blue, opacity);
1070
rgb = {r: red, g: green, b: blue, toString: clrToString};
1071
rgb.hex = "#" + (16777216 | blue | (green << 8) | (red << 16)).toString(16).slice(1);
1072
R.is(opacity, "finite") && (rgb.opacity = opacity);
1075
return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString};
1088
R.hsb = cacher(function (h, s, b) {
1089
return R.hsb2rgb(h, s, b).hex;
1102
R.hsl = cacher(function (h, s, l) {
1103
return R.hsl2rgb(h, s, l).hex;
1116
R.rgb = cacher(function (r, g, b) {
1117
function round(x) { return (x + 0.5) | 0; }
1118
return "#" + (16777216 | round(b) | (round(g) << 8) | (round(r) << 16)).toString(16).slice(1);
1129
R.getColor = function (value) {
1130
var start = this.getColor.start = this.getColor.start || {h: 0, s: 1, b: value || .75},
1131
rgb = this.hsb2rgb(start.h, start.s, start.b);
1136
start.s <= 0 && (this.getColor.start = {h: 0, s: 1, b: start.b});
1146
R.getColor.reset = function () {
1151
function catmullRom2bezier(crp, z) {
1153
for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
1155
{x: +crp[i - 2], y: +crp[i - 1]},
1156
{x: +crp[i], y: +crp[i + 1]},
1157
{x: +crp[i + 2], y: +crp[i + 3]},
1158
{x: +crp[i + 4], y: +crp[i + 5]}
1162
p[0] = {x: +crp[iLen - 2], y: +crp[iLen - 1]};
1163
} else if (iLen - 4 == i) {
1164
p[3] = {x: +crp[0], y: +crp[1]};
1165
} else if (iLen - 2 == i) {
1166
p[2] = {x: +crp[0], y: +crp[1]};
1167
p[3] = {x: +crp[2], y: +crp[3]};
1170
if (iLen - 4 == i) {
1173
p[0] = {x: +crp[i], y: +crp[i + 1]};
1177
(-p[0].x + 6 * p[1].x + p[2].x) / 6,
1178
(-p[0].y + 6 * p[1].y + p[2].y) / 6,
1179
(p[1].x + 6 * p[2].x - p[3].x) / 6,
1180
(p[1].y + 6*p[2].y - p[3].y) / 6,
1199
R.parsePathString = function (pathString) {
1203
var pth = paths(pathString);
1205
return pathClone(pth.arr);
1208
var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0},
1210
if (R.is(pathString, array) && R.is(pathString[0], array)) {
1211
data = pathClone(pathString);
1214
Str(pathString).replace(pathCommand, function (a, b, c) {
1216
name = b.toLowerCase();
1217
c.replace(pathValues, function (a, b) {
1218
b && params.push(+b);
1220
if (name == "m" && params.length > 2) {
1221
data.push([b][concat](params.splice(0, 2)));
1223
b = b == "m" ? "l" : "L";
1226
data.push([b][concat](params));
1227
} else while (params.length >= paramCounts[name]) {
1228
data.push([b][concat](params.splice(0, paramCounts[name])));
1229
if (!paramCounts[name]) {
1235
data.toString = R._path2string;
1236
pth.arr = pathClone(data);
1250
R.parseTransformString = cacher(function (TString) {
1254
var paramCounts = {r: 3, s: 4, t: 2, m: 6},
1256
if (R.is(TString, array) && R.is(TString[0], array)) {
1257
data = pathClone(TString);
1260
Str(TString).replace(tCommand, function (a, b, c) {
1262
name = lowerCase.call(b);
1263
c.replace(pathValues, function (a, b) {
1264
b && params.push(+b);
1266
data.push([b][concat](params));
1269
data.toString = R._path2string;
1271
}, this, function(elem) {
1272
if (!elem) return elem;
1274
for (var i = 0; i < elem.length; i++) {
1276
for (var j = 0; j < elem[i].length; j++) {
1277
newLevel.push(elem[i][j]);
1279
newData.push(newLevel);
1281
return newData; } );
1283
var paths = function (ps) {
1284
var p = paths.ps = paths.ps || {};
1292
setTimeout(function () {
1293
for (var key in p) if (p[has](key) && key != ps) {
1295
!p[key].sleep && delete p[key];
1340
R.findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
1346
x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x,
1347
y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y,
1348
mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),
1349
my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),
1350
nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),
1351
ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),
1352
ax = t1 * p1x + t * c1x,
1353
ay = t1 * p1y + t * c1y,
1354
cx = t1 * c2x + t * p2x,
1355
cy = t1 * c2y + t * p2y,
1356
alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI);
1357
(mx > nx || my < ny) && (alpha += 180);
1363
start: {x: ax, y: ay},
1364
end: {x: cx, y: cy},
1398
R.bezierBBox = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
1399
if (!R.is(p1x, "array")) {
1400
p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
1402
var bbox = curveDim.apply(null, p1x);
1408
width: bbox.max.x - bbox.min.x,
1409
height: bbox.max.y - bbox.min.y
1425
R.isPointInsideBBox = function (bbox, x, y) {
1426
return x >= bbox.x && x <= bbox.x2 && y >= bbox.y && y <= bbox.y2;
1440
R.isBBoxIntersect = function (bbox1, bbox2) {
1441
var i = R.isPointInsideBBox;
1442
return i(bbox2, bbox1.x, bbox1.y)
1443
|| i(bbox2, bbox1.x2, bbox1.y)
1444
|| i(bbox2, bbox1.x, bbox1.y2)
1445
|| i(bbox2, bbox1.x2, bbox1.y2)
1446
|| i(bbox1, bbox2.x, bbox2.y)
1447
|| i(bbox1, bbox2.x2, bbox2.y)
1448
|| i(bbox1, bbox2.x, bbox2.y2)
1449
|| i(bbox1, bbox2.x2, bbox2.y2)
1450
|| (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x)
1451
&& (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);
1453
function base3(t, p1, p2, p3, p4) {
1454
var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4,
1455
t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
1456
return t * t2 - 3 * p1 + 3 * p2;
1458
function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
1462
z = z > 1 ? 1 : z < 0 ? 0 : z;
1465
Tvalues = [-0.1252,0.1252,-0.3678,0.3678,-0.5873,0.5873,-0.7699,0.7699,-0.9041,0.9041,-0.9816,0.9816],
1466
Cvalues = [0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],
1468
for (var i = 0; i < n; i++) {
1469
var ct = z2 * Tvalues[i] + z2,
1470
xbase = base3(ct, x1, x2, x3, x4),
1471
ybase = base3(ct, y1, y2, y3, y4),
1472
comb = xbase * xbase + ybase * ybase;
1473
sum += Cvalues[i] * math.sqrt(comb);
1477
function getTatLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) {
1478
if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) {
1486
l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);
1487
while (abs(l - ll) > e) {
1489
t2 += (l < ll ? 1 : -1) * step;
1490
l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);
1494
function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
1496
mmax(x1, x2) < mmin(x3, x4) ||
1497
mmin(x1, x2) > mmax(x3, x4) ||
1498
mmax(y1, y2) < mmin(y3, y4) ||
1499
mmin(y1, y2) > mmax(y3, y4)
1503
var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4),
1504
ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4),
1505
denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
1510
var px = nx / denominator,
1511
py = ny / denominator,
1512
px2 = +px.toFixed(2),
1513
py2 = +py.toFixed(2);
1515
px2 < +mmin(x1, x2).toFixed(2) ||
1516
px2 > +mmax(x1, x2).toFixed(2) ||
1517
px2 < +mmin(x3, x4).toFixed(2) ||
1518
px2 > +mmax(x3, x4).toFixed(2) ||
1519
py2 < +mmin(y1, y2).toFixed(2) ||
1520
py2 > +mmax(y1, y2).toFixed(2) ||
1521
py2 < +mmin(y3, y4).toFixed(2) ||
1522
py2 > +mmax(y3, y4).toFixed(2)
1526
return {x: px, y: py};
1528
function inter(bez1, bez2) {
1529
return interHelper(bez1, bez2);
1531
function interCount(bez1, bez2) {
1532
return interHelper(bez1, bez2, 1);
1534
function interHelper(bez1, bez2, justCount) {
1535
var bbox1 = R.bezierBBox(bez1),
1536
bbox2 = R.bezierBBox(bez2);
1537
if (!R.isBBoxIntersect(bbox1, bbox2)) {
1538
return justCount ? 0 : [];
1540
var l1 = bezlen.apply(0, bez1),
1541
l2 = bezlen.apply(0, bez2),
1542
n1 = mmax(~~(l1 / 5), 1),
1543
n2 = mmax(~~(l2 / 5), 1),
1547
res = justCount ? 0 : [];
1548
for (var i = 0; i < n1 + 1; i++) {
1549
var p = R.findDotsAtSegment.apply(R, bez1.concat(i / n1));
1550
dots1.push({x: p.x, y: p.y, t: i / n1});
1552
for (i = 0; i < n2 + 1; i++) {
1553
p = R.findDotsAtSegment.apply(R, bez2.concat(i / n2));
1554
dots2.push({x: p.x, y: p.y, t: i / n2});
1556
for (i = 0; i < n1; i++) {
1557
for (var j = 0; j < n2; j++) {
1562
ci = abs(di1.x - di.x) < .001 ? "y" : "x",
1563
cj = abs(dj1.x - dj.x) < .001 ? "y" : "x",
1564
is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
1566
if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {
1569
xy[is.x.toFixed(4)] = is.y.toFixed(4);
1570
var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t),
1571
t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
1572
if (t1 >= 0 && t1 <= 1.001 && t2 >= 0 && t2 <= 1.001) {
1613
R.pathIntersection = function (path1, path2) {
1614
return interPathHelper(path1, path2);
1616
R.pathIntersectionNumber = function (path1, path2) {
1617
return interPathHelper(path1, path2, 1);
1619
function interPathHelper(path1, path2, justCount) {
1620
path1 = R._path2curve(path1);
1621
path2 = R._path2curve(path2);
1622
var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,
1623
res = justCount ? 0 : [];
1624
for (var i = 0, ii = path1.length; i < ii; i++) {
1631
bez1 = [x1, y1].concat(pi.slice(1));
1635
bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
1639
for (var j = 0, jj = path2.length; j < jj; j++) {
1646
bez2 = [x2, y2].concat(pj.slice(1));
1650
bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
1654
var intr = interHelper(bez1, bez2, justCount);
1658
for (var k = 0, kk = intr.length; k < kk; k++) {
1659
intr[k].segment1 = i;
1660
intr[k].segment2 = j;
1661
intr[k].bez1 = bez1;
1662
intr[k].bez2 = bez2;
1664
res = res.concat(intr);
1685
R.isPointInsidePath = function (path, x, y) {
1686
var bbox = R.pathBBox(path);
1687
return R.isPointInsideBBox(bbox, x, y) &&
1688
interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1;
1690
R._removedFactory = function (methodname) {
1691
return function () {
1692
eve("raphael.log", null, "Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object", methodname);
1716
var pathDimensions = R.pathBBox = function (path) {
1717
var pth = paths(path);
1719
return clone(pth.bbox);
1722
return {x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0};
1724
path = path2curve(path);
1730
for (var i = 0, ii = path.length; i < ii; i++) {
1738
var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
1739
X = X[concat](dim.min.x, dim.max.x);
1740
Y = Y[concat](dim.min.y, dim.max.y);
1745
var xmin = mmin[apply](0, X),
1746
ymin = mmin[apply](0, Y),
1747
xmax = mmax[apply](0, X),
1748
ymax = mmax[apply](0, Y),
1749
width = xmax - xmin,
1750
height = ymax - ymin,
1758
cx: xmin + width / 2,
1759
cy: ymin + height / 2
1761
pth.bbox = clone(bb);
1764
pathClone = function (pathArray) {
1765
var res = clone(pathArray);
1766
res.toString = R._path2string;
1769
pathToRelative = R._pathToRelative = function (pathArray) {
1770
var pth = paths(pathArray);
1772
return pathClone(pth.rel);
1774
if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) {
1775
pathArray = R.parsePathString(pathArray);
1783
if (pathArray[0][0] == "M") {
1784
x = pathArray[0][1];
1785
y = pathArray[0][2];
1789
res.push(["M", x, y]);
1791
for (var i = start, ii = pathArray.length; i < ii; i++) {
1792
var r = res[i] = [],
1794
if (pa[0] != lowerCase.call(pa[0])) {
1795
r[0] = lowerCase.call(pa[0]);
1803
r[6] = +(pa[6] - x).toFixed(3);
1804
r[7] = +(pa[7] - y).toFixed(3);
1807
r[1] = +(pa[1] - y).toFixed(3);
1813
for (var j = 1, jj = pa.length; j < jj; j++) {
1814
r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
1823
for (var k = 0, kk = pa.length; k < kk; k++) {
1827
var len = res[i].length;
1828
switch (res[i][0]) {
1834
x += +res[i][len - 1];
1837
y += +res[i][len - 1];
1840
x += +res[i][len - 2];
1841
y += +res[i][len - 1];
1844
res.toString = R._path2string;
1845
pth.rel = pathClone(res);
1848
pathToAbsolute = R._pathToAbsolute = function (pathArray) {
1849
var pth = paths(pathArray);
1851
return pathClone(pth.abs);
1853
if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) {
1854
pathArray = R.parsePathString(pathArray);
1856
if (!pathArray || !pathArray.length) {
1857
return [["M", 0, 0]];
1865
if (pathArray[0][0] == "M") {
1866
x = +pathArray[0][1];
1867
y = +pathArray[0][2];
1871
res[0] = ["M", x, y];
1873
var crz = pathArray.length == 3 && pathArray[0][0] == "M" && pathArray[1][0].toUpperCase() == "R" && pathArray[2][0].toUpperCase() == "Z";
1874
for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {
1877
if (pa[0] != upperCase.call(pa[0])) {
1878
r[0] = upperCase.call(pa[0]);
1886
r[6] = +(pa[6] + x);
1887
r[7] = +(pa[7] + y);
1896
var dots = [x, y][concat](pa.slice(1));
1897
for (var j = 2, jj = dots.length; j < jj; j++) {
1898
dots[j] = +dots[j] + x;
1899
dots[++j] = +dots[j] + y;
1902
res = res[concat](catmullRom2bezier(dots, crz));
1908
for (j = 1, jj = pa.length; j < jj; j++) {
1909
r[j] = +pa[j] + ((j % 2) ? x : y);
1912
} else if (pa[0] == "R") {
1913
dots = [x, y][concat](pa.slice(1));
1915
res = res[concat](catmullRom2bezier(dots, crz));
1916
r = ["R"][concat](pa.slice(-2));
1918
for (var k = 0, kk = pa.length; k < kk; k++) {
1934
mx = r[r.length - 2];
1935
my = r[r.length - 1];
1937
x = r[r.length - 2];
1938
y = r[r.length - 1];
1941
res.toString = R._path2string;
1942
pth.abs = pathClone(res);
1945
l2c = function (x1, y1, x2, y2) {
1946
return [x1, y1, x2, y2, x2, y2];
1948
q2c = function (x1, y1, ax, ay, x2, y2) {
1952
_13 * x1 + _23 * ax,
1953
_13 * y1 + _23 * ay,
1954
_13 * x2 + _23 * ax,
1955
_13 * y2 + _23 * ay,
1960
a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
1963
var _120 = PI * 120 / 180,
1964
rad = PI / 180 * (+angle || 0),
1967
rotate = cacher(function (x, y, rad) {
1968
var X = x * math.cos(rad) - y * math.sin(rad),
1969
Y = x * math.sin(rad) + y * math.cos(rad);
1970
return {x: X, y: Y};
1973
xy = rotate(x1, y1, -rad);
1976
xy = rotate(x2, y2, -rad);
1979
var cos = math.cos(PI / 180 * angle),
1980
sin = math.sin(PI / 180 * angle),
1983
var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
1991
k = (large_arc_flag == sweep_flag ? -1 : 1) *
1992
math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
1993
cx = k * rx * y / ry + (x1 + x2) / 2,
1994
cy = k * -ry * x / rx + (y1 + y2) / 2,
1995
f1 = math.asin(((y1 - cy) / ry).toFixed(9)),
1996
f2 = math.asin(((y2 - cy) / ry).toFixed(9));
1998
f1 = x1 < cx ? PI - f1 : f1;
1999
f2 = x2 < cx ? PI - f2 : f2;
2000
f1 < 0 && (f1 = PI * 2 + f1);
2001
f2 < 0 && (f2 = PI * 2 + f2);
2002
if (sweep_flag && f1 > f2) {
2005
if (!sweep_flag && f2 > f1) {
2015
if (abs(df) > _120) {
2019
f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
2020
x2 = cx + rx * math.cos(f2);
2021
y2 = cy + ry * math.sin(f2);
2022
res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
2025
var c1 = math.cos(f1),
2029
t = math.tan(df / 4),
2030
hx = 4 / 3 * rx * t,
2031
hy = 4 / 3 * ry * t,
2033
m2 = [x1 + hx * s1, y1 - hy * c1],
2034
m3 = [x2 + hx * s2, y2 - hy * c2],
2036
m2[0] = 2 * m1[0] - m2[0];
2037
m2[1] = 2 * m1[1] - m2[1];
2039
return [m2, m3, m4][concat](res);
2041
res = [m2, m3, m4][concat](res).join()[split](",");
2043
for (var i = 0, ii = res.length; i < ii; i++) {
2044
newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
2049
findDotAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
2052
x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
2053
y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y
2056
curveDim = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
2057
var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x),
2058
b = 2 * (c1x - p1x) - 2 * (c2x - c1x),
2060
t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a,
2061
t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a,
2065
abs(t1) > "1e12" && (t1 = .5);
2066
abs(t2) > "1e12" && (t2 = .5);
2067
if (t1 > 0 && t1 < 1) {
2068
dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
2072
if (t2 > 0 && t2 < 1) {
2073
dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
2077
a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y);
2078
b = 2 * (c1y - p1y) - 2 * (c2y - c1y);
2080
t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a;
2081
t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a;
2082
abs(t1) > "1e12" && (t1 = .5);
2083
abs(t2) > "1e12" && (t2 = .5);
2084
if (t1 > 0 && t1 < 1) {
2085
dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1);
2089
if (t2 > 0 && t2 < 1) {
2090
dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2);
2095
min: {x: mmin[apply](0, x), y: mmin[apply](0, y)},
2096
max: {x: mmax[apply](0, x), y: mmax[apply](0, y)}
2099
path2curve = R._path2curve = cacher(function (path, path2) {
2100
var pth = !path2 && paths(path);
2101
if (!path2 && pth.curve) {
2102
return pathClone(pth.curve);
2104
var p = pathToAbsolute(path),
2105
p2 = path2 && pathToAbsolute(path2),
2106
attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
2107
attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
2108
processPath = function (path, d, pcom) {
2109
var nx, ny, tq = {T:1, Q:1};
2111
return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
2113
!(path[0] in tq) && (d.qx = d.qy = null);
2120
path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
2123
if (pcom == "C" || pcom == "S") {
2124
nx = d.x * 2 - d.bx;
2125
ny = d.y * 2 - d.by;
2131
path = ["C", nx, ny][concat](path.slice(1));
2134
if (pcom == "Q" || pcom == "T") {
2135
d.qx = d.x * 2 - d.qx;
2136
d.qy = d.y * 2 - d.qy;
2142
path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
2147
path = ["C"][concat](q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
2150
path = ["C"][concat](l2c(d.x, d.y, path[1], path[2]));
2153
path = ["C"][concat](l2c(d.x, d.y, path[1], d.y));
2156
path = ["C"][concat](l2c(d.x, d.y, d.x, path[1]));
2159
path = ["C"][concat](l2c(d.x, d.y, d.X, d.Y));
2164
fixArc = function (pp, i) {
2165
if (pp[i].length > 7) {
2170
p2 && (pcoms2[i]="A");
2171
pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6)));
2174
ii = mmax(p.length, p2 && p2.length || 0);
2177
fixM = function (path1, path2, a1, a2, i) {
2178
if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
2179
path2.splice(i, 0, ["M", a2.x, a2.y]);
2184
ii = mmax(p.length, p2 && p2.length || 0);
2191
for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {
2192
p[i] && (pfirst = p[i][0]);
2197
i && ( pcom = pcoms1[i-1]);
2199
p[i] = processPath(p[i], attrs, pcom);
2201
if (pcoms1[i] != "A" && pfirst == "C") pcoms1[i] = "C";
2208
p2[i] && (pfirst = p2[i][0]);
2212
i && (pcom = pcoms2[i-1]);
2214
p2[i] = processPath(p2[i], attrs2, pcom);
2216
if (pcoms2[i]!="A" && pfirst=="C") pcoms2[i]="C";
2220
fixM(p, p2, attrs, attrs2, i);
2221
fixM(p2, p, attrs2, attrs, i);
2224
seglen = seg.length,
2225
seg2len = p2 && seg2.length;
2226
attrs.x = seg[seglen - 2];
2227
attrs.y = seg[seglen - 1];
2228
attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;
2229
attrs.by = toFloat(seg[seglen - 3]) || attrs.y;
2230
attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);
2231
attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);
2232
attrs2.x = p2 && seg2[seg2len - 2];
2233
attrs2.y = p2 && seg2[seg2len - 1];
2236
pth.curve = pathClone(p);
2238
return p2 ? [p, p2] : p;
2239
}, null, pathClone),
2240
parseDots = R._parseDots = cacher(function (gradient) {
2242
for (var i = 0, ii = gradient.length; i < ii; i++) {
2244
par = gradient[i].match(/^([^:]*):?([\d\.]*)/);
2245
dot.color = R.getRGB(par[1]);
2246
if (dot.color.error) {
2249
dot.opacity = dot.color.opacity;
2250
dot.color = dot.color.hex;
2251
par[2] && (dot.offset = par[2] + "%");
2254
for (i = 1, ii = dots.length - 1; i < ii; i++) {
2255
if (!dots[i].offset) {
2256
var start = toFloat(dots[i - 1].offset || 0),
2258
for (var j = i + 1; j < ii; j++) {
2259
if (dots[j].offset) {
2260
end = dots[j].offset;
2269
var d = (end - start) / (j - i + 1);
2270
for (; i < j; i++) {
2272
dots[i].offset = start + "%";
2278
tear = R._tear = function (el, paper) {
2279
el == paper.top && (paper.top = el.prev);
2280
el == paper.bottom && (paper.bottom = el.next);
2281
el.next && (el.next.prev = el.prev);
2282
el.prev && (el.prev.next = el.next);
2284
tofront = R._tofront = function (el, paper) {
2285
if (paper.top === el) {
2290
el.prev = paper.top;
2291
paper.top.next = el;
2294
toback = R._toback = function (el, paper) {
2295
if (paper.bottom === el) {
2299
el.next = paper.bottom;
2301
paper.bottom.prev = el;
2304
insertafter = R._insertafter = function (el, el2, paper) {
2306
el2 == paper.top && (paper.top = el);
2307
el2.next && (el2.next.prev = el);
2312
insertbefore = R._insertbefore = function (el, el2, paper) {
2314
el2 == paper.bottom && (paper.bottom = el);
2315
el2.prev && (el2.prev.next = el);
2332
toMatrix = R.toMatrix = function (path, transform) {
2333
var bb = pathDimensions(path),
2338
getBBox: function () {
2342
extractTransform(el, transform);
2357
transformPath = R.transformPath = function (path, transform) {
2358
return mapPath(path, toMatrix(path, transform));
2360
extractTransform = R._extractTransform = function (el, tstr) {
2362
return el._.transform;
2364
tstr = Str(tstr).replace(/\.{3}|\u2026/g, el._.transform || E);
2365
var tdata = R.parseTransformString(tstr),
2373
_.transform = tdata || [];
2375
for (var i = 0, ii = tdata.length; i < ii; i++) {
2378
command = Str(t[0]).toLowerCase(),
2379
absolute = t[0] != command,
2380
inver = absolute ? m.invert() : 0,
2386
if (command == "t" && tlen == 3) {
2390
x2 = inver.x(t[1], t[2]);
2391
y2 = inver.y(t[1], t[2]);
2392
m.translate(x2 - x1, y2 - y1);
2394
m.translate(t[1], t[2]);
2396
} else if (command == "r") {
2398
bb = bb || el.getBBox(1);
2399
m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2);
2401
} else if (tlen == 4) {
2403
x2 = inver.x(t[2], t[3]);
2404
y2 = inver.y(t[2], t[3]);
2405
m.rotate(t[1], x2, y2);
2407
m.rotate(t[1], t[2], t[3]);
2411
} else if (command == "s") {
2412
if (tlen == 2 || tlen == 3) {
2413
bb = bb || el.getBBox(1);
2414
m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2);
2417
} else if (tlen == 5) {
2419
x2 = inver.x(t[3], t[4]);
2420
y2 = inver.y(t[3], t[4]);
2421
m.scale(t[1], t[2], x2, y2);
2423
m.scale(t[1], t[2], t[3], t[4]);
2428
} else if (command == "m" && tlen == 7) {
2429
m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
2450
if (sx == 1 && sy == 1 && !deg && _.bbox) {
2457
getEmpty = function (item) {
2459
switch (l.toLowerCase()) {
2460
case "t": return [l, 0, 0];
2461
case "m": return [l, 1, 0, 0, 1, 0, 0];
2462
case "r": if (item.length == 4) {
2463
return [l, 0, item[2], item[3]];
2467
case "s": if (item.length == 5) {
2468
return [l, 1, 1, item[3], item[4]];
2469
} else if (item.length == 3) {
2476
equaliseTransform = R._equaliseTransform = function (t1, t2) {
2477
t2 = Str(t2).replace(/\.{3}|\u2026/g, t1);
2478
t1 = R.parseTransformString(t1) || [];
2479
t2 = R.parseTransformString(t2) || [];
2480
var maxlength = mmax(t1.length, t2.length),
2485
for (; i < maxlength; i++) {
2486
tt1 = t1[i] || getEmpty(t2[i]);
2487
tt2 = t2[i] || getEmpty(tt1);
2488
if ((tt1[0] != tt2[0]) ||
2489
(tt1[0].toLowerCase() == "r" && (tt1[2] != tt2[2] || tt1[3] != tt2[3])) ||
2490
(tt1[0].toLowerCase() == "s" && (tt1[3] != tt2[3] || tt1[4] != tt2[4]))
2496
for (j = 0, jj = mmax(tt1.length, tt2.length); j < jj; j++) {
2497
j in tt1 && (from[i][j] = tt1[j]);
2498
j in tt2 && (to[i][j] = tt2[j]);
2506
R._getContainer = function (x, y, w, h) {
2508
container = h == null && !R.is(x, "object") ? g.doc.getElementById(x) : x;
2509
if (container == null) {
2512
if (container.tagName) {
2515
container: container,
2516
width: container.style.pixelWidth || container.offsetWidth,
2517
height: container.style.pixelHeight || container.offsetHeight
2521
container: container,
2546
R.pathToRelative = pathToRelative;
2559
R.path2curve = path2curve;
2576
R.matrix = function (a, b, c, d, e, f) {
2577
return new Matrix(a, b, c, d, e, f);
2579
function Matrix(a, b, c, d, e, f) {
2596
(function (matrixproto) {
2612
matrixproto.add = function (a, b, c, d, e, f) {
2613
var out = [[], [], []],
2614
m = [[this.a, this.c, this.e], [this.b, this.d, this.f], [0, 0, 1]],
2615
matrix = [[a, c, e], [b, d, f], [0, 0, 1]],
2618
if (a && a instanceof Matrix) {
2619
matrix = [[a.a, a.c, a.e], [a.b, a.d, a.f], [0, 0, 1]];
2622
for (x = 0; x < 3; x++) {
2623
for (y = 0; y < 3; y++) {
2625
for (z = 0; z < 3; z++) {
2626
res += m[x][z] * matrix[z][y];
2645
matrixproto.invert = function () {
2647
x = me.a * me.d - me.b * me.c;
2648
return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x);
2657
matrixproto.clone = function () {
2658
return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
2669
matrixproto.translate = function (x, y) {
2670
this.add(1, 0, 0, 1, x, y);
2683
matrixproto.scale = function (x, y, cx, cy) {
2684
y == null && (y = x);
2685
(cx || cy) && this.add(1, 0, 0, 1, cx, cy);
2686
this.add(x, 0, 0, y, 0, 0);
2687
(cx || cy) && this.add(1, 0, 0, 1, -cx, -cy);
2699
matrixproto.rotate = function (a, x, y) {
2703
var cos = +math.cos(a).toFixed(9),
2704
sin = +math.sin(a).toFixed(9);
2705
this.add(cos, sin, -sin, cos, x, y);
2706
this.add(1, 0, 0, 1, -x, -y);
2718
matrixproto.x = function (x, y) {
2719
return x * this.a + y * this.c + this.e;
2731
matrixproto.y = function (x, y) {
2732
return x * this.b + y * this.d + this.f;
2734
matrixproto.get = function (i) {
2735
return +this[Str.fromCharCode(97 + i)].toFixed(4);
2737
matrixproto.toString = function () {
2739
"matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")" :
2740
[this.get(0), this.get(2), this.get(1), this.get(3), 0, 0].join();
2742
matrixproto.toFilter = function () {
2743
return "progid:DXImageTransform.Microsoft.Matrix(M11=" + this.get(0) +
2744
", M12=" + this.get(2) + ", M21=" + this.get(1) + ", M22=" + this.get(3) +
2745
", Dx=" + this.get(4) + ", Dy=" + this.get(5) + ", sizingmethod='auto expand')";
2747
matrixproto.offset = function () {
2748
return [this.e.toFixed(4), this.f.toFixed(4)];
2751
return a[0] * a[0] + a[1] * a[1];
2753
function normalize(a) {
2754
var mag = math.sqrt(norm(a));
2755
a[0] && (a[0] /= mag);
2756
a[1] && (a[1] /= mag);
2772
matrixproto.split = function () {
2779
var row = [[this.a, this.c], [this.b, this.d]];
2780
out.scalex = math.sqrt(norm(row[0]));
2783
out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1];
2784
row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear];
2786
out.scaley = math.sqrt(norm(row[1]));
2788
out.shear /= out.scaley;
2791
var sin = -row[0][1],
2794
out.rotate = R.deg(math.acos(cos));
2796
out.rotate = 360 - out.rotate;
2799
out.rotate = R.deg(math.asin(sin));
2802
out.isSimple = !+out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate);
2803
out.isSuperSimple = !+out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate;
2804
out.noRotation = !+out.shear.toFixed(9) && !out.rotate;
2814
matrixproto.toTransformString = function (shorter) {
2815
var s = shorter || this[split]();
2817
s.scalex = +s.scalex.toFixed(4);
2818
s.scaley = +s.scaley.toFixed(4);
2819
s.rotate = +s.rotate.toFixed(4);
2820
return (s.dx || s.dy ? "t" + [s.dx, s.dy] : E) +
2821
(s.scalex != 1 || s.scaley != 1 ? "s" + [s.scalex, s.scaley, 0, 0] : E) +
2822
(s.rotate ? "r" + [s.rotate, 0, 0] : E);
2824
return "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)];
2827
})(Matrix.prototype);
2829
var preventDefault = function () {
2830
this.returnValue = false;
2832
preventTouch = function () {
2833
return this.originalEvent.preventDefault();
2835
stopPropagation = function () {
2836
this.cancelBubble = true;
2838
stopTouch = function () {
2839
return this.originalEvent.stopPropagation();
2841
getEventPosition = function (e) {
2842
var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
2843
scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft;
2846
x: e.clientX + scrollX,
2847
y: e.clientY + scrollY
2850
addEvent = (function () {
2851
if (g.doc.addEventListener) {
2852
return function (obj, type, fn, element) {
2853
var f = function (e) {
2854
var pos = getEventPosition(e);
2855
return fn.call(element, e, pos.x, pos.y);
2857
obj.addEventListener(type, f, false);
2859
if (supportsTouch && touchMap[type]) {
2860
var _f = function (e) {
2861
var pos = getEventPosition(e),
2864
for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
2865
if (e.targetTouches[i].target == obj) {
2866
e = e.targetTouches[i];
2867
e.originalEvent = olde;
2868
e.preventDefault = preventTouch;
2869
e.stopPropagation = stopTouch;
2874
return fn.call(element, e, pos.x, pos.y);
2876
obj.addEventListener(touchMap[type], _f, false);
2879
return function () {
2880
obj.removeEventListener(type, f, false);
2882
if (supportsTouch && touchMap[type])
2883
obj.removeEventListener(touchMap[type], _f, false);
2888
} else if (g.doc.attachEvent) {
2889
return function (obj, type, fn, element) {
2890
var f = function (e) {
2891
e = e || g.win.event;
2892
var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
2893
scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
2894
x = e.clientX + scrollX,
2895
y = e.clientY + scrollY;
2896
e.preventDefault = e.preventDefault || preventDefault;
2897
e.stopPropagation = e.stopPropagation || stopPropagation;
2898
return fn.call(element, e, x, y);
2900
obj.attachEvent("on" + type, f);
2901
var detacher = function () {
2902
obj.detachEvent("on" + type, f);
2910
dragMove = function (e) {
2913
scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
2914
scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
2919
if (supportsTouch && e.touches) {
2920
var i = e.touches.length,
2923
touch = e.touches[i];
2924
if (touch.identifier == dragi.el._drag.id) {
2927
(e.originalEvent ? e.originalEvent : e).preventDefault();
2934
var node = dragi.el.node,
2936
next = node.nextSibling,
2937
parent = node.parentNode,
2938
display = node.style.display;
2939
g.win.opera && parent.removeChild(node);
2940
node.style.display = "none";
2941
o = dragi.el.paper.getElementByPoint(x, y);
2942
node.style.display = display;
2943
g.win.opera && (next ? parent.insertBefore(node, next) : parent.appendChild(node));
2944
o && eve("raphael.drag.over." + dragi.el.id, dragi.el, o);
2947
eve("raphael.drag.move." + dragi.el.id, dragi.move_scope || dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y, e);
2950
dragUp = function (e) {
2951
R.unmousemove(dragMove).unmouseup(dragUp);
2952
var i = drag.length,
2956
dragi.el._drag = {};
2957
eve("raphael.drag.end." + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e);
2975
elproto = R.el = {};
3184
for (var i = events.length; i--;) {
3185
(function (eventName) {
3186
R[eventName] = elproto[eventName] = function (fn, scope) {
3187
if (R.is(fn, "function")) {
3188
this.events = this.events || [];
3189
this.events.push({name: eventName, f: fn, unbind: addEvent(this.shape || this.node || g.doc, eventName, fn, scope || this)});
3193
R["un" + eventName] = elproto["un" + eventName] = function (fn) {
3194
var events = this.events || [],
3197
if (events[l].name == eventName && (R.is(fn, "undefined") || events[l].f == fn)) {
3199
events.splice(l, 1);
3200
!events.length && delete this.events;
3233
elproto.data = function (key, value) {
3234
var data = eldata[this.id] = eldata[this.id] || {};
3235
if (arguments.length == 0) {
3238
if (arguments.length == 1) {
3239
if (R.is(key, "object")) {
3240
for (var i in key) if (key[has](i)) {
3241
this.data(i, key[i]);
3245
eve("raphael.data.get." + this.id, this, data[key], key);
3249
eve("raphael.data.set." + this.id, this, value, key);
3262
elproto.removeData = function (key) {
3264
delete eldata[this.id];
3266
eldata[this.id] && delete eldata[this.id][key];
3277
elproto.getData = function () {
3278
return clone(eldata[this.id] || {});
3292
elproto.hover = function (f_in, f_out, scope_in, scope_out) {
3293
return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in);
3305
elproto.unhover = function (f_in, f_out) {
3306
return this.unmouseover(f_in).unmouseout(f_out);
3339
elproto.drag = function (onmove, onstart, onend, move_scope, start_scope, end_scope) {
3341
(e.originalEvent || e).preventDefault();
3344
scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
3345
scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft;
3346
this._drag.id = e.identifier;
3347
if (supportsTouch && e.touches) {
3348
var i = e.touches.length, touch;
3350
touch = e.touches[i];
3351
this._drag.id = touch.identifier;
3352
if (touch.identifier == this._drag.id) {
3359
this._drag.x = x + scrollX;
3360
this._drag.y = y + scrollY;
3361
!drag.length && R.mousemove(dragMove).mouseup(dragUp);
3362
drag.push({el: this, move_scope: move_scope, start_scope: start_scope, end_scope: end_scope});
3363
onstart && eve.on("raphael.drag.start." + this.id, onstart);
3364
onmove && eve.on("raphael.drag.move." + this.id, onmove);
3365
onend && eve.on("raphael.drag.end." + this.id, onend);
3366
eve("raphael.drag.start." + this.id, start_scope || move_scope || this, this._drag.x, this._drag.y, e);
3369
draggable.push({el: this, start: start});
3370
this.mousedown(start);
3381
elproto.onDragOver = function (f) {
3382
f ? eve.on("raphael.drag.over." + this.id, f) : eve.unbind("raphael.drag.over." + this.id);
3390
elproto.undrag = function () {
3391
var i = draggable.length;
3392
while (i--) if (draggable[i].el == this) {
3393
this.unmousedown(draggable[i].start);
3394
draggable.splice(i, 1);
3395
eve.unbind("raphael.drag.*." + this.id);
3397
!draggable.length && R.unmousemove(dragMove).unmouseup(dragUp);
3416
paperproto.circle = function (x, y, r) {
3417
var out = R._engine.circle(this, x || 0, y || 0, r || 0);
3418
this.__set__ && this.__set__.push(out);
3442
paperproto.rect = function (x, y, w, h, r) {
3443
var out = R._engine.rect(this, x || 0, y || 0, w || 0, h || 0, r || 0);
3444
this.__set__ && this.__set__.push(out);
3464
paperproto.ellipse = function (x, y, rx, ry) {
3465
var out = R._engine.ellipse(this, x || 0, y || 0, rx || 0, ry || 0);
3466
this.__set__ && this.__set__.push(out);
3501
paperproto.path = function (pathString) {
3502
pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E);
3503
var out = R._engine.path(R.format[apply](R, arguments), this);
3504
this.__set__ && this.__set__.push(out);
3525
paperproto.image = function (src, x, y, w, h) {
3526
var out = R._engine.image(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0);
3527
this.__set__ && this.__set__.push(out);
3546
paperproto.text = function (x, y, text) {
3547
var out = R._engine.text(this, x || 0, y || 0, Str(text));
3548
this.__set__ && this.__set__.push(out);
3568
paperproto.set = function (itemsArray) {
3569
!R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length));
3570
var out = new Set(itemsArray);
3571
this.__set__ && this.__set__.push(out);
3572
out["paper"] = this;
3573
out["type"] = "set";
3590
paperproto.setStart = function (set) {
3591
this.__set__ = set || this.set();
3601
paperproto.setFinish = function (set) {
3602
var out = this.__set__;
3603
delete this.__set__;
3614
paperproto.getSize = function () {
3615
var container = this.canvas.parentNode;
3617
width: container.offsetWidth,
3618
height: container.offsetHeight
3632
paperproto.setSize = function (width, height) {
3633
return R._engine.setSize.call(this, width, height);
3650
paperproto.setViewBox = function (x, y, w, h, fit) {
3651
return R._engine.setViewBox.call(this, x, y, w, h, fit);
3665
paperproto.top = paperproto.bottom = null;
3672
paperproto.raphael = R;
3673
var getOffset = function (elem) {
3674
var box = elem.getBoundingClientRect(),
3675
doc = elem.ownerDocument,
3677
docElem = doc.documentElement,
3678
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
3679
top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop ) - clientTop,
3680
left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;
3700
paperproto.getElementByPoint = function (x, y) {
3703
target = g.doc.elementFromPoint(x, y);
3704
if (g.win.opera && target.tagName == "svg") {
3705
var so = getOffset(svg),
3706
sr = svg.createSVGRect();
3709
sr.width = sr.height = 1;
3710
var hits = svg.getIntersectionList(sr, null);
3712
target = hits[hits.length - 1];
3718
while (target.parentNode && target != svg.parentNode && !target.raphael) {
3719
target = target.parentNode;
3721
target == paper.canvas.parentNode && (target = svg);
3722
target = target && target.raphael ? paper.getById(target.raphaelid) : null;
3737
paperproto.getElementsByBBox = function (bbox) {
3738
var set = this.set();
3739
this.forEach(function (el) {
3740
if (R.isBBoxIntersect(el.getBBox(), bbox)) {
3758
paperproto.getById = function (id) {
3759
var bot = this.bottom;
3786
paperproto.forEach = function (callback, thisArg) {
3787
var bot = this.bottom;
3789
if (callback.call(thisArg, bot) === false) {
3808
paperproto.getElementsByPoint = function (x, y) {
3809
var set = this.set();
3810
this.forEach(function (el) {
3811
if (el.isPointInside(x, y)) {
3818
return this.x + S + this.y;
3820
function x_y_w_h() {
3821
return this.x + S + this.y + S + this.width + " \xd7 " + this.height;
3835
elproto.isPointInside = function (x, y) {
3836
var rp = this.realPath = getPath[this.type](this);
3837
if (this.attr('transform') && this.attr('transform').length) {
3838
rp = R.transformPath(rp, this.attr('transform'));
3840
return R.isPointInsidePath(rp, x, y);
3861
elproto.getBBox = function (isWithoutTransform) {
3866
if (isWithoutTransform) {
3867
if (_.dirty || !_.bboxwt) {
3868
this.realPath = getPath[this.type](this);
3869
_.bboxwt = pathDimensions(this.realPath);
3870
_.bboxwt.toString = x_y_w_h;
3875
if (_.dirty || _.dirtyT || !_.bbox) {
3876
if (_.dirty || !this.realPath) {
3878
this.realPath = getPath[this.type](this);
3880
_.bbox = pathDimensions(mapPath(this.realPath, this.matrix));
3881
_.bbox.toString = x_y_w_h;
3882
_.dirty = _.dirtyT = 0;
3893
elproto.clone = function () {
3897
var out = this.paper[this.type]().attr(this.attr());
3898
this.__set__ && this.__set__.push(out);
3922
elproto.glow = function (glow) {
3923
if (this.type == "text") {
3928
width: (glow.width || 10) + (+this.attr("stroke-width") || 1),
3929
fill: glow.fill || false,
3930
opacity: glow.opacity == null ? .5 : glow.opacity,
3931
offsetx: glow.offsetx || 0,
3932
offsety: glow.offsety || 0,
3933
color: glow.color || "#000"
3938
path = this.realPath || getPath[this.type](this);
3939
path = this.matrix ? mapPath(path, this.matrix) : path;
3940
for (var i = 1; i < c + 1; i++) {
3941
out.push(r.path(path).attr({
3943
fill: s.fill ? s.color : "none",
3944
"stroke-linejoin": "round",
3945
"stroke-linecap": "round",
3946
"stroke-width": +(s.width / c * i).toFixed(3),
3947
opacity: +(s.opacity / c).toFixed(3)
3950
return out.insertBefore(this).translate(s.offsetx, s.offsety);
3952
var curveslengths = {},
3953
getPointAtSegmentLength = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
3954
if (length == null) {
3955
return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);
3957
return R.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, getTatLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length));
3960
getLengthFactory = function (istotal, subpath) {
3961
return function (path, length, onlystart) {
3962
path = path2curve(path);
3963
var x, y, p, l, sp = "", subpaths = {}, point,
3965
for (var i = 0, ii = path.length; i < ii; i++) {
3971
l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
3972
if (len + l > length) {
3973
if (subpath && !subpaths.start) {
3974
point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
3975
sp += ["C" + point.start.x, point.start.y, point.m.x, point.m.y, point.x, point.y];
3976
if (onlystart) {return sp;}
3977
subpaths.start = sp;
3978
sp = ["M" + point.x, point.y + "C" + point.n.x, point.n.y, point.end.x, point.end.y, p[5], p[6]].join();
3984
if (!istotal && !subpath) {
3985
point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
3986
return {x: point.x, y: point.y, alpha: point.alpha};
3993
sp += p.shift() + p;
3996
point = istotal ? len : subpath ? subpaths : R.findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1);
3997
point.alpha && (point = {x: point.x, y: point.y, alpha: point.alpha});
4001
var getTotalLength = getLengthFactory(1),
4002
getPointAtLength = getLengthFactory(),
4003
getSubpathsAtLength = getLengthFactory(0, 1);
4016
R.getTotalLength = getTotalLength;
4035
R.getPointAtLength = getPointAtLength;
4050
R.getSubpath = function (path, from, to) {
4051
if (this.getTotalLength(path) - to < 1e-6) {
4052
return getSubpathsAtLength(path, from).end;
4054
var a = getSubpathsAtLength(path, to, 1);
4055
return from ? getSubpathsAtLength(a, from).end : a;
4064
elproto.getTotalLength = function () {
4065
var path = this.getPath();
4070
if (this.node.getTotalLength) {
4071
return this.node.getTotalLength();
4074
return getTotalLength(path);
4093
elproto.getPointAtLength = function (length) {
4094
var path = this.getPath();
4099
return getPointAtLength(path, length);
4109
elproto.getPath = function () {
4111
getPath = R._getPath[this.type];
4113
if (this.type == "text" || this.type == "set") {
4118
path = getPath(this);
4136
elproto.getSubpath = function (from, to) {
4137
var path = this.getPath();
4142
return R.getSubpath(path, from, to);
4161
var ef = R.easing_formulas = {
4162
linear: function (n) {
4171
"<>": function (n) {
4172
var q = .48 - n / 1.04,
4173
Q = math.sqrt(.1734 + q * q),
4175
X = pow(abs(x), 1 / 3) * (x < 0 ? -1 : 1),
4177
Y = pow(abs(y), 1 / 3) * (y < 0 ? -1 : 1),
4179
return (1 - t) * 3 * t * t + t * t * t;
4181
backIn: function (n) {
4183
return n * n * ((s + 1) * n - s);
4185
backOut: function (n) {
4188
return n * n * ((s + 1) * n + s) + 1;
4190
elastic: function (n) {
4194
return pow(2, -10 * n) * math.sin((n - .075) * (2 * PI) / .3) + 1;
4196
bounce: function (n) {
4205
l = s * n * n + .75;
4207
if (n < (2.5 / p)) {
4209
l = s * n * n + .9375;
4212
l = s * n * n + .984375;
4219
ef.easeIn = ef["ease-in"] = ef["<"];
4220
ef.easeOut = ef["ease-out"] = ef[">"];
4221
ef.easeInOut = ef["ease-in-out"] = ef["<>"];
4222
ef["back-in"] = ef.backIn;
4223
ef["back-out"] = ef.backOut;
4225
var animationElements = [],
4226
requestAnimFrame = window.requestAnimationFrame ||
4227
window.webkitRequestAnimationFrame ||
4228
window.mozRequestAnimationFrame ||
4229
window.oRequestAnimationFrame ||
4230
window.msRequestAnimationFrame ||
4231
function (callback) {
4232
setTimeout(callback, 16);
4234
animation = function () {
4235
var Now = +new Date,
4237
for (; l < animationElements.length; l++) {
4238
var e = animationElements[l];
4239
if (e.el.removed || e.paused) {
4242
var time = Now - e.start,
4255
time = (e.initstatus * e.anim.top - e.prev) / (e.percent - e.prev) * ms;
4256
e.status = e.initstatus;
4257
delete e.initstatus;
4258
e.stop && animationElements.splice(l--, 1);
4260
e.status = (e.prev + (e.percent - e.prev) * (time / ms)) / e.anim.top;
4266
var pos = easing(time / ms);
4267
for (var attr in from) if (from[has](attr)) {
4268
switch (availableAnimAttrs[attr]) {
4270
now = +from[attr] + pos * ms * diff[attr];
4274
upto255(round(from[attr].r + pos * ms * diff[attr].r)),
4275
upto255(round(from[attr].g + pos * ms * diff[attr].g)),
4276
upto255(round(from[attr].b + pos * ms * diff[attr].b))
4281
for (var i = 0, ii = from[attr].length; i < ii; i++) {
4282
now[i] = [from[attr][i][0]];
4283
for (var j = 1, jj = from[attr][i].length; j < jj; j++) {
4284
now[i][j] = +from[attr][i][j] + pos * ms * diff[attr][i][j];
4286
now[i] = now[i].join(S);
4291
if (diff[attr].real) {
4293
for (i = 0, ii = from[attr].length; i < ii; i++) {
4294
now[i] = [from[attr][i][0]];
4295
for (j = 1, jj = from[attr][i].length; j < jj; j++) {
4296
now[i][j] = from[attr][i][j] + pos * ms * diff[attr][i][j];
4300
var get = function (i) {
4301
return +from[attr][i] + pos * ms * diff[attr][i];
4304
now = [["m", get(0), get(1), get(2), get(3), get(4), get(5)]];
4308
if (attr == "clip-rect") {
4312
now[i] = +from[attr][i] + pos * ms * diff[attr][i];
4317
var from2 = [][concat](from[attr]);
4319
i = that.paper.customAttributes[attr].length;
4321
now[i] = +from2[i] + pos * ms * diff[attr][i];
4328
(function (id, that, anim) {
4329
setTimeout(function () {
4330
eve("raphael.anim.frame." + id, that, anim);
4332
})(that.id, that, e.anim);
4334
(function(f, el, a) {
4335
setTimeout(function() {
4336
eve("raphael.anim.frame." + el.id, el, a);
4337
eve("raphael.anim.finish." + el.id, el, a);
4338
R.is(f, "function") && f.call(el);
4340
})(e.callback, that, e.anim);
4342
animationElements.splice(l--, 1);
4343
if (e.repeat > 1 && !e.next) {
4344
for (key in to) if (to[has](key)) {
4345
init[key] = e.totalOrigin[key];
4348
runAnimation(e.anim, e.el, e.anim.percents[0], null, e.totalOrigin, e.repeat - 1);
4350
if (e.next && !e.stop) {
4351
runAnimation(e.anim, e.el, e.next, null, e.totalOrigin, e.repeat);
4355
animationElements.length && requestAnimFrame(animation);
4357
upto255 = function (color) {
4358
return color > 255 ? 255 : color < 0 ? 0 : color;
4381
elproto.animateWith = function (el, anim, params, ms, easing, callback) {
4383
if (element.removed) {
4384
callback && callback.call(element);
4387
var a = params instanceof Animation ? params : R.animation(params, ms, easing, callback),
4389
runAnimation(a, element, a.percents[0], null, element.attr());
4390
for (var i = 0, ii = animationElements.length; i < ii; i++) {
4391
if (animationElements[i].anim == anim && animationElements[i].el == el) {
4392
animationElements[ii - 1].start = animationElements[i].start;
4403
function CubicBezierAtTime(t, p1x, p1y, p2x, p2y, duration) {
4405
bx = 3 * (p2x - p1x) - cx,
4408
by = 3 * (p2y - p1y) - cy,
4410
function sampleCurveX(t) {
4411
return ((ax * t + bx) * t + cx) * t;
4413
function solve(x, epsilon) {
4414
var t = solveCurveX(x, epsilon);
4415
return ((ay * t + by) * t + cy) * t;
4417
function solveCurveX(x, epsilon) {
4418
var t0, t1, t2, x2, d2, i;
4419
for(t2 = x, i = 0; i < 8; i++) {
4420
x2 = sampleCurveX(t2) - x;
4421
if (abs(x2) < epsilon) {
4424
d2 = (3 * ax * t2 + 2 * bx) * t2 + cx;
4425
if (abs(d2) < 1e-6) {
4440
x2 = sampleCurveX(t2);
4441
if (abs(x2 - x) < epsilon) {
4449
t2 = (t1 - t0) / 2 + t0;
4453
return solve(t, 1 / (200 * duration));
4455
elproto.onAnimation = function (f) {
4456
f ? eve.on("raphael.anim.frame." + this.id, f) : eve.unbind("raphael.anim.frame." + this.id);
4459
function Animation(anim, ms) {
4465
for (var attr in anim) if (anim[has](attr)) {
4466
newAnim[toFloat(attr)] = anim[attr];
4467
percents.push(toFloat(attr));
4469
percents.sort(sortByNumber);
4471
this.anim = newAnim;
4472
this.top = percents[percents.length - 1];
4473
this.percents = percents;
4490
Animation.prototype.delay = function (delay) {
4491
var a = new Animation(this.anim, this.ms);
4492
a.times = this.times;
4493
a.del = +delay || 0;
4508
Animation.prototype.repeat = function (times) {
4509
var a = new Animation(this.anim, this.ms);
4511
a.times = math.floor(mmax(times, 0)) || 1;
4514
function runAnimation(anim, element, percent, status, totalOrigin, times) {
4515
percent = toFloat(percent);
4528
for (i = 0, ii = animationElements.length; i < ii; i++) {
4529
var e = animationElements[i];
4530
if (e.el.id == element.id && e.anim == anim) {
4531
if (e.percent != percent) {
4532
animationElements.splice(i, 1);
4537
element.attr(e.totalOrigin);
4544
for (var i = 0, ii = anim.percents.length; i < ii; i++) {
4545
if (anim.percents[i] == percent || anim.percents[i] > status * anim.top) {
4546
percent = anim.percents[i];
4547
prev = anim.percents[i - 1] || 0;
4548
ms = ms / anim.top * (percent - prev);
4549
next = anim.percents[i + 1];
4550
params = anim.anim[percent];
4552
} else if (status) {
4553
element.attr(anim.anim[anim.percents[i]]);
4560
for (var attr in params) if (params[has](attr)) {
4561
if (availableAnimAttrs[has](attr) || element.paper.customAttributes[has](attr)) {
4562
from[attr] = element.attr(attr);
4563
(from[attr] == null) && (from[attr] = availableAttrs[attr]);
4564
to[attr] = params[attr];
4565
switch (availableAnimAttrs[attr]) {
4567
diff[attr] = (to[attr] - from[attr]) / ms;
4570
from[attr] = R.getRGB(from[attr]);
4571
var toColour = R.getRGB(to[attr]);
4573
r: (toColour.r - from[attr].r) / ms,
4574
g: (toColour.g - from[attr].g) / ms,
4575
b: (toColour.b - from[attr].b) / ms
4579
var pathes = path2curve(from[attr], to[attr]),
4581
from[attr] = pathes[0];
4583
for (i = 0, ii = from[attr].length; i < ii; i++) {
4584
diff[attr][i] = [0];
4585
for (var j = 1, jj = from[attr][i].length; j < jj; j++) {
4586
diff[attr][i][j] = (toPath[i][j] - from[attr][i][j]) / ms;
4592
eq = equaliseTransform(_[attr], to[attr]);
4594
from[attr] = eq.from;
4597
diff[attr].real = true;
4598
for (i = 0, ii = from[attr].length; i < ii; i++) {
4599
diff[attr][i] = [from[attr][i][0]];
4600
for (j = 1, jj = from[attr][i].length; j < jj; j++) {
4601
diff[attr][i][j] = (to[attr][i][j] - from[attr][i][j]) / ms;
4605
var m = (element.matrix || new Matrix),
4607
_: {transform: _.transform},
4608
getBBox: function () {
4609
return element.getBBox(1);
4620
extractTransform(to2, to[attr]);
4621
to[attr] = to2._.transform;
4623
(to2.matrix.a - m.a) / ms,
4624
(to2.matrix.b - m.b) / ms,
4625
(to2.matrix.c - m.c) / ms,
4626
(to2.matrix.d - m.d) / ms,
4627
(to2.matrix.e - m.e) / ms,
4628
(to2.matrix.f - m.f) / ms
4643
var values = Str(params[attr])[split](separator),
4644
from2 = Str(from[attr])[split](separator);
4645
if (attr == "clip-rect") {
4650
diff[attr][i] = (values[i] - from[attr][i]) / ms;
4656
values = [][concat](params[attr]);
4657
from2 = [][concat](from[attr]);
4659
i = element.paper.customAttributes[attr].length;
4661
diff[attr][i] = ((values[i] || 0) - (from2[i] || 0)) / ms;
4667
var easing = params.easing,
4668
easyeasy = R.easing_formulas[easing];
4670
easyeasy = Str(easing).match(bezierrg);
4671
if (easyeasy && easyeasy.length == 5) {
4672
var curve = easyeasy;
4673
easyeasy = function (t) {
4674
return CubicBezierAtTime(t, +curve[1], +curve[2], +curve[3], +curve[4], ms);
4680
timestamp = params.start || anim.start || +new Date;
4684
timestamp: timestamp,
4685
start: timestamp + (anim.del || 0),
4687
initstatus: status || 0,
4695
callback: params.callback,
4698
repeat: times || anim.times,
4699
origin: element.attr(),
4700
totalOrigin: totalOrigin
4702
animationElements.push(e);
4703
if (status && !isInAnim && !isInAnimSet) {
4705
e.start = new Date - ms * status;
4706
if (animationElements.length == 1) {
4711
e.start = new Date - e.ms * status;
4713
animationElements.length == 1 && requestAnimFrame(animation);
4715
isInAnim.initstatus = status;
4716
isInAnim.start = new Date - isInAnim.ms * status;
4718
eve("raphael.anim.start." + element.id, element, anim);
4736
R.animation = function (params, ms, easing, callback) {
4737
if (params instanceof Animation) {
4740
if (R.is(easing, "function") || !easing) {
4741
callback = callback || easing || null;
4744
params = Object(params);
4749
for (attr in params) if (params[has](attr) && toFloat(attr) != attr && toFloat(attr) + "%" != attr) {
4751
p[attr] = params[attr];
4758
for(var i in params){
4759
var percent = toInt(i);
4760
if(params[has](i) && percent > lastKey){
4766
!params[lastKey].callback && (params[lastKey].callback = callback);
4768
return new Animation(params, ms);
4770
easing && (p.easing = easing);
4771
callback && (p.callback = callback);
4772
return new Animation({100: p}, ms);
4792
elproto.animate = function (params, ms, easing, callback) {
4794
if (element.removed) {
4795
callback && callback.call(element);
4798
var anim = params instanceof Animation ? params : R.animation(params, ms, easing, callback);
4799
runAnimation(anim, element, anim.percents[0], null, element.attr());
4818
elproto.setTime = function (anim, value) {
4819
if (anim && value != null) {
4820
this.status(anim, mmin(value, anim.ms) / anim.ms);
4845
elproto.status = function (anim, value) {
4850
if (value != null) {
4851
runAnimation(anim, this, -1, mmin(value, 1));
4854
len = animationElements.length;
4855
for (; i < len; i++) {
4856
e = animationElements[i];
4857
if (e.el.id == this.id && (!anim || e.anim == anim)) {
4885
elproto.pause = function (anim) {
4886
for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
4887
if (eve("raphael.anim.pause." + this.id, this, animationElements[i].anim) !== false) {
4888
animationElements[i].paused = true;
4905
elproto.resume = function (anim) {
4906
for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
4907
var e = animationElements[i];
4908
if (eve("raphael.anim.resume." + this.id, this, e.anim) !== false) {
4910
this.status(e.anim, e.status);
4927
elproto.stop = function (anim) {
4928
for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) {
4929
if (eve("raphael.anim.stop." + this.id, this, animationElements[i].anim) !== false) {
4930
animationElements.splice(i--, 1);
4935
function stopAnimation(paper) {
4936
for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.paper == paper) {
4937
animationElements.splice(i--, 1);
4940
eve.on("raphael.remove", stopAnimation);
4941
eve.on("raphael.clear", stopAnimation);
4942
elproto.toString = function () {
4943
return "Rapha\xebl\u2019s object";
4947
var Set = function (items) {
4952
for (var i = 0, ii = items.length; i < ii; i++) {
4953
if (items[i] && (items[i].constructor == elproto.constructor || items[i].constructor == Set)) {
4954
this[this.items.length] = this.items[this.items.length] = items[i];
4960
setproto = Set.prototype;
4968
setproto.push = function () {
4971
for (var i = 0, ii = arguments.length; i < ii; i++) {
4972
item = arguments[i];
4973
if (item && (item.constructor == elproto.constructor || item.constructor == Set)) {
4974
len = this.items.length;
4975
this[len] = this.items[len] = item;
4988
setproto.pop = function () {
4989
this.length && delete this[this.length--];
4990
return this.items.pop();
5006
setproto.forEach = function (callback, thisArg) {
5007
for (var i = 0, ii = this.items.length; i < ii; i++) {
5008
if (callback.call(thisArg, this.items[i], i) === false) {
5014
for (var method in elproto) if (elproto[has](method)) {
5015
setproto[method] = (function (methodname) {
5016
return function () {
5017
var arg = arguments;
5018
return this.forEach(function (el) {
5019
el[methodname][apply](el, arg);
5024
setproto.attr = function (name, value) {
5025
if (name && R.is(name, array) && R.is(name[0], "object")) {
5026
for (var j = 0, jj = name.length; j < jj; j++) {
5027
this.items[j].attr(name[j]);
5030
for (var i = 0, ii = this.items.length; i < ii; i++) {
5031
this.items[i].attr(name, value);
5042
setproto.clear = function () {
5043
while (this.length) {
5060
setproto.splice = function (index, count, insertion) {
5061
index = index < 0 ? mmax(this.length + index, 0) : index;
5062
count = mmax(0, mmin(this.length - index, count));
5067
for (i = 2; i < arguments.length; i++) {
5068
args.push(arguments[i]);
5070
for (i = 0; i < count; i++) {
5071
todel.push(this[index + i]);
5073
for (; i < this.length - index; i++) {
5074
tail.push(this[index + i]);
5076
var arglen = args.length;
5077
for (i = 0; i < arglen + tail.length; i++) {
5078
this.items[index + i] = this[index + i] = i < arglen ? args[i] : tail[i - arglen];
5080
i = this.items.length = this.length -= count - arglen;
5084
return new Set(todel);
5097
setproto.exclude = function (el) {
5098
for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {
5103
setproto.animate = function (params, ms, easing, callback) {
5104
(R.is(easing, "function") || !easing) && (callback = easing || null);
5105
var len = this.items.length,
5113
callback && (collector = function () {
5114
!--len && callback.call(set);
5116
easing = R.is(easing, string) ? easing : collector;
5117
var anim = R.animation(params, ms, easing, collector);
5118
item = this.items[--i].animate(anim);
5120
this.items[i] && !this.items[i].removed && this.items[i].animateWith(item, anim, anim);
5121
(this.items[i] && !this.items[i].removed) || len--;
5125
setproto.insertAfter = function (el) {
5126
var i = this.items.length;
5128
this.items[i].insertAfter(el);
5132
setproto.getBBox = function () {
5137
for (var i = this.items.length; i--;) if (!this.items[i].removed) {
5138
var box = this.items[i].getBBox();
5141
x2.push(box.x + box.width);
5142
y2.push(box.y + box.height);
5144
x = mmin[apply](0, x);
5145
y = mmin[apply](0, y);
5146
x2 = mmax[apply](0, x2);
5147
y2 = mmax[apply](0, y2);
5157
setproto.clone = function (s) {
5158
s = this.paper.set();
5159
for (var i = 0, ii = this.items.length; i < ii; i++) {
5160
s.push(this.items[i].clone());
5164
setproto.toString = function () {
5165
return "Rapha\xebl\u2018s set";
5168
setproto.glow = function(glowConfig) {
5169
var ret = this.paper.set();
5170
this.forEach(function(shape, index){
5171
var g = shape.glow(glowConfig);
5173
g.forEach(function(shape2, index2){
5194
setproto.isPointInside = function (x, y) {
5195
var isPointInside = false;
5196
this.forEach(function (el) {
5197
if (el.isPointInside(x, y)) {
5198
isPointInside = true;
5202
return isPointInside;
5220
R.registerFont = function (font) {
5224
this.fonts = this.fonts || {};
5230
family = font.face["font-family"];
5231
for (var prop in font.face) if (font.face[has](prop)) {
5232
fontcopy.face[prop] = font.face[prop];
5234
if (this.fonts[family]) {
5235
this.fonts[family].push(fontcopy);
5237
this.fonts[family] = [fontcopy];
5240
fontcopy.face["units-per-em"] = toInt(font.face["units-per-em"], 10);
5241
for (var glyph in font.glyphs) if (font.glyphs[has](glyph)) {
5242
var path = font.glyphs[glyph];
5243
fontcopy.glyphs[glyph] = {
5246
d: path.d && "M" + path.d.replace(/[mlcxtrv]/g, function (command) {
5247
return {l: "L", c: "C", x: "z", t: "m", r: "l", v: "c"}[command] || "M";
5251
for (var k in path.k) if (path[has](k)) {
5252
fontcopy.glyphs[glyph].k[k] = path.k[k];
5275
paperproto.getFont = function (family, weight, style, stretch) {
5276
stretch = stretch || "normal";
5277
style = style || "normal";
5278
weight = +weight || {normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400;
5282
var font = R.fonts[family];
5284
var name = new RegExp("(^|\\s)" + family.replace(/[^\w\d\s+!~.:_-]/g, E) + "(\\s|$)", "i");
5285
for (var fontName in R.fonts) if (R.fonts[has](fontName)) {
5286
if (name.test(fontName)) {
5287
font = R.fonts[fontName];
5294
for (var i = 0, ii = font.length; i < ii; i++) {
5296
if (thefont.face["font-weight"] == weight && (thefont.face["font-style"] == style || !thefont.face["font-style"]) && thefont.face["font-stretch"] == stretch) {
5324
paperproto.print = function (x, y, string, font, size, origin, letter_spacing, line_spacing) {
5325
origin = origin || "middle";
5326
letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1);
5327
line_spacing = mmax(mmin(line_spacing || 1, 3), 1);
5328
var letters = Str(string)[split](E),
5333
R.is(font, "string") && (font = this.getFont(font));
5335
scale = (size || 16) / font.face["units-per-em"];
5336
var bb = font.face.bbox[split](separator),
5338
lineHeight = bb[3] - bb[1],
5340
height = +bb[1] + (origin == "baseline" ? lineHeight + (+font.face.descent) : lineHeight / 2);
5341
for (var i = 0, ii = letters.length; i < ii; i++) {
5342
if (letters[i] == "\n") {
5346
shifty += lineHeight * line_spacing;
5348
var prev = notfirst && font.glyphs[letters[i - 1]] || {},
5349
curr = font.glyphs[letters[i]];
5350
shift += notfirst ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0;
5353
if (curr && curr.d) {
5354
path += R.transformPath(curr.d, ["t", shift * scale, shifty * scale, "s", scale, scale, top, height, "t", (x - top) / scale, (y - height) / scale]);
5358
return this.path(path).attr({
5392
paperproto.add = function (json) {
5393
if (R.is(json, "array")) {
5394
var res = this.set(),
5398
for (; i < ii; i++) {
5400
elements[has](j.type) && res.push(this[j.type]().attr(j));
5425
R.format = function (token, params) {
5426
var args = R.is(params, array) ? [0][concat](params) : arguments;
5427
token && R.is(token, string) && args.length - 1 && (token = token.replace(formatrg, function (str, i) {
5428
return args[++i] == null ? E : args[i];
5455
R.fullfill = (function () {
5456
var tokenRegex = /\{([^\}]+)\}/g,
5457
objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,
5458
replacer = function (all, key, obj) {
5460
key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) {
5461
name = name || quotedName;
5466
typeof res == "function" && isFunc && (res = res());
5469
res = (res == null || res == obj ? all : res) + "";
5472
return function (str, obj) {
5473
return String(str).replace(tokenRegex, function (all, key) {
5474
return replacer(all, key, obj);
5492
R.ninja = function () {
5493
if (oldRaphael.was) {
5494
g.win.Raphael = oldRaphael.is;
5497
window.Raphael = undefined;
5499
delete window.Raphael;
5526
eve.on("raphael.DOMload", function () {
5531
(function (doc, loaded, f) {
5532
if (doc.readyState == null && doc.addEventListener){
5533
doc.addEventListener(loaded, f = function () {
5534
doc.removeEventListener(loaded, f, false);
5535
doc.readyState = "complete";
5537
doc.readyState = "loading";
5539
function isLoaded() {
5540
(/in/).test(doc.readyState) ? setTimeout(isLoaded, 9) : R.eve("raphael.DOMload");
5543
})(document, "DOMContentLoaded");
5546
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
5547
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
5552
"./dev/raphael.svg.js":
5557
(function(module, exports, __webpack_require__) {
5559
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__( "./dev/raphael.core.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function(R) {
5564
var has = "hasOwnProperty",
5566
toFloat = parseFloat,
5572
separator = /[, ]+/,
5576
var xlink = "http://www.w3.org/1999/xlink",
5578
block: "M5,0 0,2.5 5,5z",
5579
classic: "M5,0 0,2.5 5,5 3.5,3 3.5,2z",
5580
diamond: "M2.5,0 5,2.5 2.5,5 0,2.5z",
5581
open: "M6,1 1,3.5 6,6",
5582
oval: "M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"
5585
R.toString = function () {
5586
return "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version;
5588
var $ = function (el, attr) {
5590
if (typeof el == "string") {
5593
for (var key in attr) if (attr[has](key)) {
5594
if (key.substring(0, 6) == "xlink:") {
5595
el.setAttributeNS(xlink, key.substring(6), Str(attr[key]));
5597
el.setAttribute(key, Str(attr[key]));
5601
el = R._g.doc.createElementNS("http://www.w3.org/2000/svg", el);
5602
el.style && (el.style.webkitTapHighlightColor = "rgba(0,0,0,0)");
5606
addGradientFill = function (element, gradient) {
5607
var type = "linear",
5608
id = element.id + gradient,
5611
SVG = element.paper,
5613
el = R._g.doc.getElementById(id);
5615
gradient = Str(gradient).replace(R._radial_gradient, function (all, _fx, _fy) {
5620
var dir = ((fy > .5) * 2 - 1);
5621
pow(fx - .5, 2) + pow(fy - .5, 2) > .25 &&
5622
(fy = math.sqrt(.25 - pow(fx - .5, 2)) * dir + .5) &&
5624
(fy = fy.toFixed(5) - 1e-5 * dir);
5628
gradient = gradient.split(/\s*\-\s*/);
5629
if (type == "linear") {
5630
var angle = gradient.shift();
5631
angle = -toFloat(angle);
5635
var vector = [0, 0, math.cos(R.rad(angle)), math.sin(R.rad(angle))],
5636
max = 1 / (mmax(abs(vector[2]), abs(vector[3])) || 1);
5639
if (vector[2] < 0) {
5640
vector[0] = -vector[2];
5643
if (vector[3] < 0) {
5644
vector[1] = -vector[3];
5648
var dots = R._parseDots(gradient);
5652
id = id.replace(/[\(\)\s,\xb0#]/g, "_");
5654
if (element.gradient && id != element.gradient.id) {
5655
SVG.defs.removeChild(element.gradient);
5656
delete element.gradient;
5659
if (!element.gradient) {
5660
el = $(type + "Gradient", {id: id});
5661
element.gradient = el;
5662
$(el, type == "radial" ? {
5670
gradientTransform: element.matrix.invert()
5672
SVG.defs.appendChild(el);
5673
for (var i = 0, ii = dots.length; i < ii; i++) {
5674
el.appendChild($("stop", {
5675
offset: dots[i].offset ? dots[i].offset : i ? "100%" : "0%",
5676
"stop-color": dots[i].color || "#fff",
5677
"stop-opacity": isFinite(dots[i].opacity) ? dots[i].opacity : 1
5692
isIE9or10 = function () {
5693
var mode = document.documentMode;
5694
return mode && (mode === 9 || mode === 10);
5696
fillurl = function (id) {
5698
return "url('#" + id + "')";
5700
var location = document.location;
5701
var locationString = (
5702
location.protocol + '//' +
5707
return "url('" + locationString + "#" + id + "')";
5709
updatePosition = function (o) {
5710
var bbox = o.getBBox(1);
5711
$(o.pattern, {patternTransform: o.matrix.invert() + " translate(" + bbox.x + "," + bbox.y + ")"});
5713
addArrow = function (o, value, isEnd) {
5714
if (o.type == "path") {
5715
var values = Str(value).toLowerCase().split("-"),
5717
se = isEnd ? "end" : "start",
5720
stroke = attrs["stroke-width"],
5732
switch (values[i]) {
5741
case "wide": h = 5; break;
5742
case "narrow": h = 2; break;
5743
case "long": w = 5; break;
5744
case "short": w = 2; break;
5747
if (type == "open") {
5752
refX = isEnd ? 4 : 1;
5755
stroke: attrs.stroke
5766
o._.arrows.endPath && markerCounter[o._.arrows.endPath]--;
5767
o._.arrows.endMarker && markerCounter[o._.arrows.endMarker]--;
5769
o._.arrows.startPath && markerCounter[o._.arrows.startPath]--;
5770
o._.arrows.startMarker && markerCounter[o._.arrows.startMarker]--;
5775
if (type != "none") {
5776
var pathId = "raphael-marker-" + type,
5777
markerId = "raphael-marker-" + se + type + w + h + "-obj" + o.id;
5778
if (!R._g.doc.getElementById(pathId)) {
5779
p.defs.appendChild($($("path"), {
5780
"stroke-linecap": "round",
5784
markerCounter[pathId] = 1;
5786
markerCounter[pathId]++;
5788
var marker = R._g.doc.getElementById(markerId),
5791
marker = $($("marker"), {
5800
"xlink:href": "#" + pathId,
5801
transform: (isEnd ? "rotate(180 " + w / 2 + " " + h / 2 + ") " : E) + "scale(" + w / t + "," + h / t + ")",
5802
"stroke-width": (1 / ((w / t + h / t) / 2)).toFixed(4)
5804
marker.appendChild(use);
5805
p.defs.appendChild(marker);
5806
markerCounter[markerId] = 1;
5808
markerCounter[markerId]++;
5809
use = marker.getElementsByTagName("use")[0];
5812
var delta = dx * (type != "diamond" && type != "oval");
5814
from = o._.arrows.startdx * stroke || 0;
5815
to = R.getTotalLength(attrs.path) - delta * stroke;
5817
from = delta * stroke;
5818
to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0);
5821
attr["marker-" + se] = "url(#" + markerId + ")";
5823
attr.d = R.getSubpath(attrs.path, from, to);
5826
o._.arrows[se + "Path"] = pathId;
5827
o._.arrows[se + "Marker"] = markerId;
5828
o._.arrows[se + "dx"] = delta;
5829
o._.arrows[se + "Type"] = type;
5830
o._.arrows[se + "String"] = value;
5833
from = o._.arrows.startdx * stroke || 0;
5834
to = R.getTotalLength(attrs.path) - from;
5837
to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0);
5839
o._.arrows[se + "Path"] && $(node, {d: R.getSubpath(attrs.path, from, to)});
5840
delete o._.arrows[se + "Path"];
5841
delete o._.arrows[se + "Marker"];
5842
delete o._.arrows[se + "dx"];
5843
delete o._.arrows[se + "Type"];
5844
delete o._.arrows[se + "String"];
5846
for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) {
5847
var item = R._g.doc.getElementById(attr);
5848
item && item.parentNode.removeChild(item);
5856
"-..": [3, 1, 1, 1, 1, 1],
5860
"- .": [4, 3, 1, 3],
5861
"--.": [8, 3, 1, 3],
5862
"--..": [8, 3, 1, 3, 1, 3]
5864
addDashes = function (o, value, params) {
5865
value = dasharray[Str(value).toLowerCase()];
5867
var width = o.attrs["stroke-width"] || "1",
5868
butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
5872
dashes[i] = value[i] * width + ((i % 2) ? 1 : -1) * butt;
5874
$(o.node, {"stroke-dasharray": dashes.join(",")});
5877
$(o.node, {"stroke-dasharray": "none"});
5880
setFillAndStroke = function (o, params) {
5883
vis = node.style.visibility;
5884
node.style.visibility = "hidden";
5885
for (var att in params) {
5886
if (params[has](att)) {
5887
if (!R._availableAttrs[has](att)) {
5890
var value = params[att];
5897
var title = node.getElementsByTagName("title");
5900
if (title.length && (title = title[0])) {
5901
title.firstChild.nodeValue = value;
5904
var val = R._g.doc.createTextNode(value);
5905
title.appendChild(val);
5906
node.appendChild(title);
5911
var pn = node.parentNode;
5912
if (pn.tagName.toLowerCase() != "a") {
5914
pn.insertBefore(hl, node);
5915
hl.appendChild(node);
5918
if (att == "target") {
5919
pn.setAttributeNS(xlink, "show", value == "blank" ? "new" : value);
5921
pn.setAttributeNS(xlink, att, value);
5925
node.style.cursor = value;
5934
addArrow(o, value, 1);
5937
var rect = Str(value).split(separator);
5938
if (rect.length == 4) {
5939
o.clip && o.clip.parentNode.parentNode.removeChild(o.clip.parentNode);
5940
var el = $("clipPath"),
5942
el.id = R.createUUID();
5950
o.paper.defs.appendChild(el);
5951
$(node, {"clip-path": "url(#" + el.id + ")"});
5955
var path = node.getAttribute("clip-path");
5957
var clip = R._g.doc.getElementById(path.replace(/(^url\(#|\)$)/g, E));
5958
clip && clip.parentNode.removeChild(clip);
5959
$(node, {"clip-path": E});
5965
if (o.type == "path") {
5966
$(node, {d: value ? attrs.path = R._pathToAbsolute(value) : "M0,0"});
5969
"startString" in o._.arrows && addArrow(o, o._.arrows.startString);
5970
"endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1);
5975
node.setAttribute(att, value);
5985
value = -attrs.x - (attrs.width || 0);
5988
if (att == "rx" && o.type == "rect") {
5992
node.setAttribute(att, value);
5993
o.pattern && updatePosition(o);
5997
node.setAttribute(att, value);
6007
value = -attrs.y - (attrs.height || 0);
6010
if (att == "ry" && o.type == "rect") {
6014
node.setAttribute(att, value);
6015
o.pattern && updatePosition(o);
6019
if (o.type == "rect") {
6020
$(node, {rx: value, ry: value});
6022
node.setAttribute(att, value);
6027
if (o.type == "image") {
6028
node.setAttributeNS(xlink, "href", value);
6031
case "stroke-width":
6032
if (o._.sx != 1 || o._.sy != 1) {
6033
value /= mmax(abs(o._.sx), abs(o._.sy)) || 1;
6035
node.setAttribute(att, value);
6036
if (attrs["stroke-dasharray"]) {
6037
addDashes(o, attrs["stroke-dasharray"], params);
6040
"startString" in o._.arrows && addArrow(o, o._.arrows.startString);
6041
"endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1);
6044
case "stroke-dasharray":
6045
addDashes(o, value, params);
6048
var isURL = Str(value).match(R._ISURL);
6051
var ig = $("image");
6052
el.id = R.createUUID();
6053
$(el, {x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1});
6054
$(ig, {x: 0, y: 0, "xlink:href": isURL[1]});
6058
R._preload(isURL[1], function () {
6059
var w = this.offsetWidth,
6060
h = this.offsetHeight;
6061
$(el, {width: w, height: h});
6062
$(ig, {width: w, height: h});
6065
o.paper.defs.appendChild(el);
6066
$(node, {fill: "url(#" + el.id + ")"});
6068
o.pattern && updatePosition(o);
6071
var clr = R.getRGB(value);
6073
delete params.gradient;
6074
delete attrs.gradient;
6075
!R.is(attrs.opacity, "undefined") &&
6076
R.is(params.opacity, "undefined") &&
6077
$(node, {opacity: attrs.opacity});
6078
!R.is(attrs["fill-opacity"], "undefined") &&
6079
R.is(params["fill-opacity"], "undefined") &&
6080
$(node, {"fill-opacity": attrs["fill-opacity"]});
6081
} else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) {
6082
if ("opacity" in attrs || "fill-opacity" in attrs) {
6083
var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
6085
var stops = gradient.getElementsByTagName("stop");
6086
$(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)});
6089
attrs.gradient = value;
6090
attrs.fill = "none";
6093
clr[has]("opacity") && $(node, {"fill-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity});
6095
clr = R.getRGB(value);
6096
node.setAttribute(att, clr.hex);
6097
att == "stroke" && clr[has]("opacity") && $(node, {"stroke-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity});
6098
if (att == "stroke" && o._.arrows) {
6099
"startString" in o._.arrows && addArrow(o, o._.arrows.startString);
6100
"endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1);
6104
(o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value);
6107
if (attrs.gradient && !attrs[has]("stroke-opacity")) {
6108
$(node, {"stroke-opacity": value > 1 ? value / 100 : value});
6111
case "fill-opacity":
6112
if (attrs.gradient) {
6113
gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
6115
stops = gradient.getElementsByTagName("stop");
6116
$(stops[stops.length - 1], {"stop-opacity": value});
6121
att == "font-size" && (value = toInt(value, 10) + "px");
6122
var cssrule = att.replace(/(\-.)/g, function (w) {
6123
return w.substring(1).toUpperCase();
6125
node.style[cssrule] = value;
6127
node.setAttribute(att, value);
6133
tuneText(o, params);
6134
node.style.visibility = vis;
6137
tuneText = function (el, params) {
6138
if (el.type != "text" || !(params[has]("text") || params[has]("font") || params[has]("font-size") || params[has]("x") || params[has]("y"))) {
6143
fontSize = node.firstChild ? toInt(R._g.doc.defaultView.getComputedStyle(node.firstChild, E).getPropertyValue("font-size"), 10) : 10;
6145
if (params[has]("text")) {
6146
a.text = params.text;
6147
while (node.firstChild) {
6148
node.removeChild(node.firstChild);
6150
var texts = Str(params.text).split("\n"),
6153
for (var i = 0, ii = texts.length; i < ii; i++) {
6155
i && $(tspan, {dy: fontSize * leading, x: a.x});
6156
tspan.appendChild(R._g.doc.createTextNode(texts[i]));
6157
node.appendChild(tspan);
6161
tspans = node.getElementsByTagName("tspan");
6162
for (i = 0, ii = tspans.length; i < ii; i++) if (i) {
6163
$(tspans[i], {dy: fontSize * leading, x: a.x});
6165
$(tspans[0], {dy: 0});
6168
$(node, {x: a.x, y: a.y});
6170
var bb = el._getBBox(),
6171
dif = a.y - (bb.y + bb.height / 2);
6172
dif && R.is(dif, "finite") && $(tspans[0], {dy: dif});
6174
getRealNode = function (node) {
6175
if (node.parentNode && node.parentNode.tagName.toLowerCase() === "a") {
6176
return node.parentNode;
6181
Element = function (node, svg) {
6198
this[0] = this.node = node;
6211
node.raphael = true;
6220
node.raphaelid = this.id;
6227
return ("0000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5);
6230
this.matrix = R.matrix();
6231
this.realPath = null;
6245
this.attrs = this.attrs || {};
6255
!svg.bottom && (svg.bottom = this);
6262
this.prev = svg.top;
6263
svg.top && (svg.top.next = this);
6275
Element.prototype = elproto;
6276
elproto.constructor = Element;
6278
R._engine.path = function (pathString, SVG) {
6280
SVG.canvas && SVG.canvas.appendChild(el);
6281
var p = new Element(el, SVG);
6283
setFillAndStroke(p, {
6304
elproto.rotate = function (deg, cx, cy) {
6308
deg = Str(deg).split(separator);
6309
if (deg.length - 1) {
6310
cx = toFloat(deg[1]);
6311
cy = toFloat(deg[2]);
6313
deg = toFloat(deg[0]);
6314
(cy == null) && (cx = cy);
6315
if (cx == null || cy == null) {
6316
var bbox = this.getBBox(1);
6317
cx = bbox.x + bbox.width / 2;
6318
cy = bbox.y + bbox.height / 2;
6320
this.transform(this._.transform.concat([["r", deg, cx, cy]]));
6338
elproto.scale = function (sx, sy, cx, cy) {
6342
sx = Str(sx).split(separator);
6343
if (sx.length - 1) {
6344
sy = toFloat(sx[1]);
6345
cx = toFloat(sx[2]);
6346
cy = toFloat(sx[3]);
6348
sx = toFloat(sx[0]);
6349
(sy == null) && (sy = sx);
6350
(cy == null) && (cx = cy);
6351
if (cx == null || cy == null) {
6352
var bbox = this.getBBox(1);
6354
cx = cx == null ? bbox.x + bbox.width / 2 : cx;
6355
cy = cy == null ? bbox.y + bbox.height / 2 : cy;
6356
this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
6370
elproto.translate = function (dx, dy) {
6374
dx = Str(dx).split(separator);
6375
if (dx.length - 1) {
6376
dy = toFloat(dx[1]);
6378
dx = toFloat(dx[0]) || 0;
6380
this.transform(this._.transform.concat([["t", dx, dy]]));
6420
elproto.transform = function (tstr) {
6425
R._extractTransform(this, tstr);
6427
this.clip && $(this.clip, {transform: this.matrix.invert()});
6428
this.pattern && updatePosition(this);
6429
this.node && $(this.node, {transform: this.matrix});
6431
if (_.sx != 1 || _.sy != 1) {
6432
var sw = this.attrs[has]("stroke-width") ? this.attrs["stroke-width"] : 1;
6433
this.attr({"stroke-width": sw});
6445
elproto.hide = function () {
6446
if(!this.removed) this.node.style.display = "none";
6456
elproto.show = function () {
6457
if(!this.removed) this.node.style.display = "";
6466
elproto.remove = function () {
6467
var node = getRealNode(this.node);
6468
if (this.removed || !node.parentNode) {
6471
var paper = this.paper;
6472
paper.__set__ && paper.__set__.exclude(this);
6473
eve.unbind("raphael.*.*." + this.id);
6474
if (this.gradient) {
6475
paper.defs.removeChild(this.gradient);
6477
R._tear(this, paper);
6479
node.parentNode.removeChild(node);
6484
for (var i in this) {
6485
this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
6487
this.removed = true;
6489
elproto._getBBox = function () {
6490
if (this.node.style.display == "none") {
6494
var canvasHidden = false,
6496
if (this.paper.canvas.parentElement) {
6497
containerStyle = this.paper.canvas.parentElement.style;
6499
else if (this.paper.canvas.parentNode) {
6500
containerStyle = this.paper.canvas.parentNode.style;
6503
if(containerStyle && containerStyle.display == "none") {
6504
canvasHidden = true;
6505
containerStyle.display = "";
6509
bbox = this.node.getBBox();
6513
x: this.node.clientLeft,
6514
y: this.node.clientTop,
6515
width: this.node.clientWidth,
6516
height: this.node.clientHeight
6521
containerStyle.display = "none";
6524
hide && this.hide();
6608
elproto.attr = function (name, value) {
6614
for (var a in this.attrs) if (this.attrs[has](a)) {
6615
res[a] = this.attrs[a];
6617
res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
6618
res.transform = this._.transform;
6621
if (value == null && R.is(name, "string")) {
6622
if (name == "fill" && this.attrs.fill == "none" && this.attrs.gradient) {
6623
return this.attrs.gradient;
6625
if (name == "transform") {
6626
return this._.transform;
6628
var names = name.split(separator),
6630
for (var i = 0, ii = names.length; i < ii; i++) {
6632
if (name in this.attrs) {
6633
out[name] = this.attrs[name];
6634
} else if (R.is(this.paper.customAttributes[name], "function")) {
6635
out[name] = this.paper.customAttributes[name].def;
6637
out[name] = R._availableAttrs[name];
6640
return ii - 1 ? out : out[names[0]];
6642
if (value == null && R.is(name, "array")) {
6644
for (i = 0, ii = name.length; i < ii; i++) {
6645
out[name[i]] = this.attr(name[i]);
6649
if (value != null) {
6651
params[name] = value;
6652
} else if (name != null && R.is(name, "object")) {
6655
for (var key in params) {
6656
eve("raphael.attr." + key + "." + this.id, this, params[key]);
6658
for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
6659
var par = this.paper.customAttributes[key].apply(this, [].concat(params[key]));
6660
this.attrs[key] = params[key];
6661
for (var subkey in par) if (par[has](subkey)) {
6662
params[subkey] = par[subkey];
6665
setFillAndStroke(this, params);
6675
elproto.toFront = function () {
6679
var node = getRealNode(this.node);
6680
node.parentNode.appendChild(node);
6681
var svg = this.paper;
6682
svg.top != this && R._tofront(this, svg);
6692
elproto.toBack = function () {
6696
var node = getRealNode(this.node);
6697
var parentNode = node.parentNode;
6698
parentNode.insertBefore(node, parentNode.firstChild);
6699
R._toback(this, this.paper);
6700
var svg = this.paper;
6710
elproto.insertAfter = function (element) {
6711
if (this.removed || !element) {
6715
var node = getRealNode(this.node);
6716
var afterNode = getRealNode(element.node || element[element.length - 1].node);
6717
if (afterNode.nextSibling) {
6718
afterNode.parentNode.insertBefore(node, afterNode.nextSibling);
6720
afterNode.parentNode.appendChild(node);
6722
R._insertafter(this, element, this.paper);
6732
elproto.insertBefore = function (element) {
6733
if (this.removed || !element) {
6737
var node = getRealNode(this.node);
6738
var beforeNode = getRealNode(element.node || element[0].node);
6739
beforeNode.parentNode.insertBefore(node, beforeNode);
6740
R._insertbefore(this, element, this.paper);
6743
elproto.blur = function (size) {
6747
var fltr = $("filter"),
6748
blur = $("feGaussianBlur");
6749
t.attrs.blur = size;
6750
fltr.id = R.createUUID();
6751
$(blur, {stdDeviation: +size || 1.5});
6752
fltr.appendChild(blur);
6753
t.paper.defs.appendChild(fltr);
6755
$(t.node, {filter: "url(#" + fltr.id + ")"});
6758
t._blur.parentNode.removeChild(t._blur);
6760
delete t.attrs.blur;
6762
t.node.removeAttribute("filter");
6766
R._engine.circle = function (svg, x, y, r) {
6767
var el = $("circle");
6768
svg.canvas && svg.canvas.appendChild(el);
6769
var res = new Element(el, svg);
6770
res.attrs = {cx: x, cy: y, r: r, fill: "none", stroke: "#000"};
6771
res.type = "circle";
6775
R._engine.rect = function (svg, x, y, w, h, r) {
6777
svg.canvas && svg.canvas.appendChild(el);
6778
var res = new Element(el, svg);
6779
res.attrs = {x: x, y: y, width: w, height: h, rx: r || 0, ry: r || 0, fill: "none", stroke: "#000"};
6784
R._engine.ellipse = function (svg, x, y, rx, ry) {
6785
var el = $("ellipse");
6786
svg.canvas && svg.canvas.appendChild(el);
6787
var res = new Element(el, svg);
6788
res.attrs = {cx: x, cy: y, rx: rx, ry: ry, fill: "none", stroke: "#000"};
6789
res.type = "ellipse";
6793
R._engine.image = function (svg, src, x, y, w, h) {
6794
var el = $("image");
6795
$(el, {x: x, y: y, width: w, height: h, preserveAspectRatio: "none"});
6796
el.setAttributeNS(xlink, "href", src);
6797
svg.canvas && svg.canvas.appendChild(el);
6798
var res = new Element(el, svg);
6799
res.attrs = {x: x, y: y, width: w, height: h, src: src};
6803
R._engine.text = function (svg, x, y, text) {
6805
svg.canvas && svg.canvas.appendChild(el);
6806
var res = new Element(el, svg);
6810
"text-anchor": "middle",
6812
"font-family": R._availableAttrs["font-family"],
6813
"font-size": R._availableAttrs["font-size"],
6818
setFillAndStroke(res, res.attrs);
6821
R._engine.setSize = function (width, height) {
6822
this.width = width || this.width;
6823
this.height = height || this.height;
6824
this.canvas.setAttribute("width", this.width);
6825
this.canvas.setAttribute("height", this.height);
6826
if (this._viewBox) {
6827
this.setViewBox.apply(this, this._viewBox);
6831
R._engine.create = function () {
6832
var con = R._getContainer.apply(0, arguments),
6833
container = con && con.container;
6835
throw new Error("SVG container not found.");
6840
height = con.height,
6842
css = "overflow:hidden;",
6846
width = width || 512;
6847
height = height || 342;
6852
xmlns: "http://www.w3.org/2000/svg",
6853
"xmlns:xlink": "http://www.w3.org/1999/xlink"
6855
if (container == 1) {
6856
cnvs.style.cssText = css + "position:absolute;left:" + x + "px;top:" + y + "px";
6857
R._g.doc.body.appendChild(cnvs);
6860
cnvs.style.cssText = css + "position:relative";
6861
if (container.firstChild) {
6862
container.insertBefore(cnvs, container.firstChild);
6864
container.appendChild(cnvs);
6867
container = new R._Paper;
6868
container.width = width;
6869
container.height = height;
6870
container.canvas = cnvs;
6872
container._left = container._top = 0;
6873
isFloating && (container.renderfix = function () {});
6874
container.renderfix();
6877
R._engine.setViewBox = function (x, y, w, h, fit) {
6878
eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]);
6879
var paperSize = this.getSize(),
6880
size = mmax(w / paperSize.width, h / paperSize.height),
6882
aspectRatio = fit ? "xMidYMid meet" : "xMinYMin",
6889
delete this._vbSize;
6890
vb = "0 0 " + this.width + S + this.height;
6892
this._vbSize = size;
6893
vb = x + S + y + S + w + S + h;
6897
preserveAspectRatio: aspectRatio
6899
while (size && top) {
6900
sw = "stroke-width" in top.attrs ? top.attrs["stroke-width"] : 1;
6901
top.attr({"stroke-width": sw});
6906
this._viewBox = [x, y, w, h, !!fit];
6919
R.prototype.renderfix = function () {
6920
var cnvs = this.canvas,
6924
pos = cnvs.getScreenCTM() || cnvs.createSVGMatrix();
6926
pos = cnvs.createSVGMatrix();
6928
var left = -pos.e % 1,
6932
this._left = (this._left + left) % 1;
6933
s.left = this._left + "px";
6936
this._top = (this._top + top) % 1;
6937
s.top = this._top + "px";
6947
R.prototype.clear = function () {
6948
R.eve("raphael.clear", this);
6949
var c = this.canvas;
6950
while (c.firstChild) {
6951
c.removeChild(c.firstChild);
6953
this.bottom = this.top = null;
6954
(this.desc = $("desc")).appendChild(R._g.doc.createTextNode("Created with Rapha\xebl " + R.version));
6955
c.appendChild(this.desc);
6956
c.appendChild(this.defs = $("defs"));
6964
R.prototype.remove = function () {
6965
eve("raphael.remove", this);
6966
this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
6967
for (var i in this) {
6968
this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
6971
var setproto = R.st;
6972
for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
6973
setproto[method] = (function (methodname) {
6974
return function () {
6975
var arg = arguments;
6976
return this.forEach(function (el) {
6977
el[methodname].apply(el, arg);
6982
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
6983
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
6988
"./dev/raphael.vml.js":
6993
(function(module, exports, __webpack_require__) {
6995
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__( "./dev/raphael.core.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function(R) {
7000
var has = "hasOwnProperty",
7002
toFloat = parseFloat,
7008
fillString = "fill",
7009
separator = /[, ]+/,
7011
ms = " progid:DXImageTransform.Microsoft",
7014
map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
7015
bites = /([clmz]),?([^clmz]*)/gi,
7016
blurregexp = / progid:\S+Blur\([^\)]+\)/g,
7017
val = /-?[^,\s-]+/g,
7018
cssDot = "position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",
7020
pathTypes = {path: 1, rect: 1, image: 1},
7021
ovalTypes = {circle: 1, ellipse: 1},
7022
path2vml = function (path) {
7023
var total = /[ahqstv]/ig,
7024
command = R._pathToAbsolute;
7025
Str(path).match(total) && (command = R._path2curve);
7027
if (command == R._pathToAbsolute && !Str(path).match(total)) {
7028
var res = Str(path).replace(bites, function (all, command, args) {
7030
isMove = command.toLowerCase() == "m",
7032
args.replace(val, function (value) {
7033
if (isMove && vals.length == 2) {
7034
res += vals + map[command == "m" ? "l" : "L"];
7037
vals.push(round(value * zoom));
7043
var pa = command(path), p, r;
7045
for (var i = 0, ii = pa.length; i < ii; i++) {
7047
r = pa[i][0].toLowerCase();
7048
r == "z" && (r = "x");
7049
for (var j = 1, jj = p.length; j < jj; j++) {
7050
r += round(p[j] * zoom) + (j != jj - 1 ? "," : E);
7056
compensation = function (deg, dx, dy) {
7058
m.rotate(-deg, .5, .5);
7064
setCoords = function (p, sx, sy, dx, dy, deg) {
7067
fillpos = _.fillpos,
7075
s.visibility = "hidden";
7079
o.coordsize = abs(kx) + S + abs(ky);
7080
s.rotation = deg * (sx * sy < 0 ? -1 : 1);
7082
var c = compensation(deg, dx, dy);
7086
sx < 0 && (flip += "x");
7087
sy < 0 && (flip += " y") && (y = -1);
7089
o.coordorigin = (dx * -kx) + S + (dy * -ky);
7090
if (fillpos || _.fillsize) {
7091
var fill = o.getElementsByTagName(fillString);
7092
fill = fill && fill[0];
7093
o.removeChild(fill);
7095
c = compensation(deg, m.x(fillpos[0], fillpos[1]), m.y(fillpos[0], fillpos[1]));
7096
fill.position = c.dx * y + S + c.dy * y;
7099
fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy);
7101
o.appendChild(fill);
7103
s.visibility = "visible";
7105
R.toString = function () {
7106
return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
7108
var addArrow = function (o, value, isEnd) {
7109
var values = Str(value).toLowerCase().split("-"),
7110
se = isEnd ? "end" : "start",
7116
switch (values[i]) {
7126
case "narrow": h = values[i]; break;
7128
case "short": w = values[i]; break;
7131
var stroke = o.node.getElementsByTagName("stroke")[0];
7132
stroke[se + "arrow"] = type;
7133
stroke[se + "arrowlength"] = w;
7134
stroke[se + "arrowwidth"] = h;
7136
setFillAndStroke = function (o, params) {
7138
o.attrs = o.attrs || {};
7143
newpath = pathTypes[o.type] && (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.cx != a.cx || params.cy != a.cy || params.rx != a.rx || params.ry != a.ry || params.r != a.r),
7144
isOval = ovalTypes[o.type] && (a.cx != params.cx || a.cy != params.cy || a.r != params.r || a.rx != params.rx || a.ry != params.ry),
7148
for (var par in params) if (params[has](par)) {
7149
a[par] = params[par];
7152
a.path = R._getPath[o.type](o);
7155
params.href && (node.href = params.href);
7156
params.title && (node.title = params.title);
7157
params.target && (node.target = params.target);
7158
params.cursor && (s.cursor = params.cursor);
7159
"blur" in params && o.blur(params.blur);
7160
if (params.path && o.type == "path" || newpath) {
7161
node.path = path2vml(~Str(a.path).toLowerCase().indexOf("r") ? R._pathToAbsolute(a.path) : a.path);
7163
if (o.type == "image") {
7164
o._.fillpos = [a.x, a.y];
7165
o._.fillsize = [a.width, a.height];
7166
setCoords(o, 1, 1, 0, 0, 0);
7169
"transform" in params && o.transform(params.transform);
7173
rx = +a.rx || +a.r || 0,
7174
ry = +a.ry || +a.r || 0;
7175
node.path = R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", round((cx - rx) * zoom), round((cy - ry) * zoom), round((cx + rx) * zoom), round((cy + ry) * zoom), round(cx * zoom));
7178
if ("clip-rect" in params) {
7179
var rect = Str(params["clip-rect"]).split(separator);
7180
if (rect.length == 4) {
7181
rect[2] = +rect[2] + (+rect[0]);
7182
rect[3] = +rect[3] + (+rect[1]);
7183
var div = node.clipRect || R._g.doc.createElement("div"),
7185
dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
7186
if (!node.clipRect) {
7187
dstyle.position = "absolute";
7190
dstyle.width = o.paper.width + "px";
7191
dstyle.height = o.paper.height + "px";
7192
node.parentNode.insertBefore(div, node);
7193
div.appendChild(node);
7194
node.clipRect = div;
7197
if (!params["clip-rect"]) {
7198
node.clipRect && (node.clipRect.style.clip = "auto");
7202
var textpathStyle = o.textpath.style;
7203
params.font && (textpathStyle.font = params.font);
7204
params["font-family"] && (textpathStyle.fontFamily = '"' + params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, E) + '"');
7205
params["font-size"] && (textpathStyle.fontSize = params["font-size"]);
7206
params["font-weight"] && (textpathStyle.fontWeight = params["font-weight"]);
7207
params["font-style"] && (textpathStyle.fontStyle = params["font-style"]);
7209
if ("arrow-start" in params) {
7210
addArrow(res, params["arrow-start"]);
7212
if ("arrow-end" in params) {
7213
addArrow(res, params["arrow-end"], 1);
7215
if (params.opacity != null ||
7216
params.fill != null ||
7217
params.src != null ||
7218
params.stroke != null ||
7219
params["stroke-width"] != null ||
7220
params["stroke-opacity"] != null ||
7221
params["fill-opacity"] != null ||
7222
params["stroke-dasharray"] != null ||
7223
params["stroke-miterlimit"] != null ||
7224
params["stroke-linejoin"] != null ||
7225
params["stroke-linecap"] != null) {
7226
var fill = node.getElementsByTagName(fillString),
7228
fill = fill && fill[0];
7229
!fill && (newfill = fill = createNode(fillString));
7230
if (o.type == "image" && params.src) {
7231
fill.src = params.src;
7233
params.fill && (fill.on = true);
7234
if (fill.on == null || params.fill == "none" || params.fill === null) {
7237
if (fill.on && params.fill) {
7238
var isURL = Str(params.fill).match(R._ISURL);
7240
fill.parentNode == node && node.removeChild(fill);
7242
fill.src = isURL[1];
7244
var bbox = o.getBBox(1);
7245
fill.position = bbox.x + S + bbox.y;
7246
o._.fillpos = [bbox.x, bbox.y];
7248
R._preload(isURL[1], function () {
7249
o._.fillsize = [this.offsetWidth, this.offsetHeight];
7252
fill.color = R.getRGB(params.fill).hex;
7254
fill.type = "solid";
7255
if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill, fill)) {
7257
a.gradient = params.fill;
7258
fill.rotate = false;
7262
if ("fill-opacity" in params || "opacity" in params) {
7263
var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
7264
opacity = mmin(mmax(opacity, 0), 1);
7265
fill.opacity = opacity;
7267
fill.color = "none";
7270
node.appendChild(fill);
7271
var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]),
7273
!stroke && (newstroke = stroke = createNode("stroke"));
7274
if ((params.stroke && params.stroke != "none") ||
7275
params["stroke-width"] ||
7276
params["stroke-opacity"] != null ||
7277
params["stroke-dasharray"] ||
7278
params["stroke-miterlimit"] ||
7279
params["stroke-linejoin"] ||
7280
params["stroke-linecap"]) {
7283
(params.stroke == "none" || params.stroke === null || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false);
7284
var strokeColor = R.getRGB(params.stroke);
7285
stroke.on && params.stroke && (stroke.color = strokeColor.hex);
7286
opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
7287
var width = (toFloat(params["stroke-width"]) || 1) * .75;
7288
opacity = mmin(mmax(opacity, 0), 1);
7289
params["stroke-width"] == null && (width = a["stroke-width"]);
7290
params["stroke-width"] && (stroke.weight = width);
7291
width && width < 1 && (opacity *= width) && (stroke.weight = 1);
7292
stroke.opacity = opacity;
7294
params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
7295
stroke.miterlimit = params["stroke-miterlimit"] || 8;
7296
params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
7297
if ("stroke-dasharray" in params) {
7301
"-.": "shortdashdot",
7302
"-..": "shortdashdotdot",
7307
"--.": "longdashdot",
7308
"--..": "longdashdotdot"
7310
stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E;
7312
newstroke && node.appendChild(stroke);
7314
if (res.type == "text") {
7315
res.paper.canvas.style.display = E;
7316
var span = res.paper.span,
7318
fontSize = a.font && a.font.match(/\d+(?:\.\d*)?(?=px)/);
7320
a.font && (s.font = a.font);
7321
a["font-family"] && (s.fontFamily = a["font-family"]);
7322
a["font-weight"] && (s.fontWeight = a["font-weight"]);
7323
a["font-style"] && (s.fontStyle = a["font-style"]);
7324
fontSize = toFloat(a["font-size"] || fontSize && fontSize[0]) || 10;
7325
s.fontSize = fontSize * m + "px";
7326
res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, "<br>"));
7327
var brect = span.getBoundingClientRect();
7328
res.W = a.w = (brect.right - brect.left) / m;
7329
res.H = a.h = (brect.bottom - brect.top) / m;
7332
res.Y = a.y + res.H / 2;
7334
("x" in params || "y" in params) && (res.path.v = R.format("m{0},{1}l{2},{1}", round(a.x * zoom), round(a.y * zoom), round(a.x * zoom) + 1));
7335
var dirtyattrs = ["x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size"];
7336
for (var d = 0, dd = dirtyattrs.length; d < dd; d++) if (dirtyattrs[d] in params) {
7342
switch (a["text-anchor"]) {
7344
res.textpath.style["v-text-align"] = "left";
7345
res.bbx = res.W / 2;
7348
res.textpath.style["v-text-align"] = "right";
7349
res.bbx = -res.W / 2;
7352
res.textpath.style["v-text-align"] = "center";
7356
res.textpath.style["v-text-kern"] = true;
7360
addGradientFill = function (o, gradient, fill) {
7361
o.attrs = o.attrs || {};
7362
var attrs = o.attrs,
7368
o.attrs.gradient = gradient;
7369
gradient = Str(gradient).replace(R._radial_gradient, function (all, fx, fy) {
7374
pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5);
7379
gradient = gradient.split(/\s*\-\s*/);
7380
if (type == "linear") {
7381
var angle = gradient.shift();
7382
angle = -toFloat(angle);
7387
var dots = R._parseDots(gradient);
7391
o = o.shape || o.node;
7393
o.removeChild(fill);
7395
fill.method = "none";
7396
fill.color = dots[0].color;
7397
fill.color2 = dots[dots.length - 1].color;
7399
for (var i = 0, ii = dots.length; i < ii; i++) {
7400
dots[i].offset && clrs.push(dots[i].offset + S + dots[i].color);
7402
fill.colors = clrs.length ? clrs.join() : "0% " + fill.color;
7403
if (type == "radial") {
7404
fill.type = "gradientTitle";
7405
fill.focus = "100%";
7406
fill.focussize = "0 0";
7407
fill.focusposition = fxfy;
7411
fill.type = "gradient";
7412
fill.angle = (270 - angle) % 360;
7414
o.appendChild(fill);
7418
Element = function (node, vml) {
7419
this[0] = this.node = node;
7420
node.raphael = true;
7422
node.raphaelid = this.id;
7427
this.matrix = R.matrix();
7438
!vml.bottom && (vml.bottom = this);
7439
this.prev = vml.top;
7440
vml.top && (vml.top.next = this);
7446
Element.prototype = elproto;
7447
elproto.constructor = Element;
7448
elproto.transform = function (tstr) {
7450
return this._.transform;
7452
var vbs = this.paper._viewBoxShift,
7453
vbt = vbs ? "s" + [vbs.scale, vbs.scale] + "-1-1t" + [vbs.dx, vbs.dy] : E,
7456
oldt = tstr = Str(tstr).replace(/\.{3}|\u2026/g, this._.transform || E);
7458
R._extractTransform(this, vbt + tstr);
7459
var matrix = this.matrix.clone(),
7463
isGrad = ~Str(this.attrs.fill).indexOf("-"),
7464
isPatt = !Str(this.attrs.fill).indexOf("url(");
7465
matrix.translate(1, 1);
7466
if (isPatt || isGrad || this.type == "image") {
7467
skew.matrix = "1 0 0 1";
7468
skew.offset = "0 0";
7469
split = matrix.split();
7470
if ((isGrad && split.noRotation) || !split.isSimple) {
7471
o.style.filter = matrix.toFilter();
7472
var bb = this.getBBox(),
7473
bbt = this.getBBox(1),
7476
o.coordorigin = (dx * -zoom) + S + (dy * -zoom);
7477
setCoords(this, 1, 1, dx, dy, 0);
7480
setCoords(this, split.scalex, split.scaley, split.dx, split.dy, split.rotate);
7484
skew.matrix = Str(matrix);
7485
skew.offset = matrix.offset();
7487
if (oldt !== null) {
7488
this._.transform = oldt;
7489
R._extractTransform(this, oldt);
7493
elproto.rotate = function (deg, cx, cy) {
7500
deg = Str(deg).split(separator);
7501
if (deg.length - 1) {
7502
cx = toFloat(deg[1]);
7503
cy = toFloat(deg[2]);
7505
deg = toFloat(deg[0]);
7506
(cy == null) && (cx = cy);
7507
if (cx == null || cy == null) {
7508
var bbox = this.getBBox(1);
7509
cx = bbox.x + bbox.width / 2;
7510
cy = bbox.y + bbox.height / 2;
7513
this.transform(this._.transform.concat([["r", deg, cx, cy]]));
7516
elproto.translate = function (dx, dy) {
7520
dx = Str(dx).split(separator);
7521
if (dx.length - 1) {
7522
dy = toFloat(dx[1]);
7524
dx = toFloat(dx[0]) || 0;
7527
this._.bbox.x += dx;
7528
this._.bbox.y += dy;
7530
this.transform(this._.transform.concat([["t", dx, dy]]));
7533
elproto.scale = function (sx, sy, cx, cy) {
7537
sx = Str(sx).split(separator);
7538
if (sx.length - 1) {
7539
sy = toFloat(sx[1]);
7540
cx = toFloat(sx[2]);
7541
cy = toFloat(sx[3]);
7542
isNaN(cx) && (cx = null);
7543
isNaN(cy) && (cy = null);
7545
sx = toFloat(sx[0]);
7546
(sy == null) && (sy = sx);
7547
(cy == null) && (cx = cy);
7548
if (cx == null || cy == null) {
7549
var bbox = this.getBBox(1);
7551
cx = cx == null ? bbox.x + bbox.width / 2 : cx;
7552
cy = cy == null ? bbox.y + bbox.height / 2 : cy;
7554
this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
7558
elproto.hide = function () {
7559
!this.removed && (this.node.style.display = "none");
7562
elproto.show = function () {
7563
!this.removed && (this.node.style.display = E);
7567
elproto.auxGetBBox = R.el.getBBox;
7568
elproto.getBBox = function(){
7569
var b = this.auxGetBBox();
7570
if (this.paper && this.paper._viewBoxShift)
7573
var z = 1/this.paper._viewBoxShift.scale;
7574
c.x = b.x - this.paper._viewBoxShift.dx;
7576
c.y = b.y - this.paper._viewBoxShift.dy;
7578
c.width = b.width * z;
7579
c.height = b.height * z;
7580
c.x2 = c.x + c.width;
7581
c.y2 = c.y + c.height;
7586
elproto._getBBox = function () {
7591
x: this.X + (this.bbx || 0) - this.W / 2,
7597
elproto.remove = function () {
7598
if (this.removed || !this.node.parentNode) {
7601
this.paper.__set__ && this.paper.__set__.exclude(this);
7602
R.eve.unbind("raphael.*.*." + this.id);
7603
R._tear(this, this.paper);
7604
this.node.parentNode.removeChild(this.node);
7605
this.shape && this.shape.parentNode.removeChild(this.shape);
7606
for (var i in this) {
7607
this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
7609
this.removed = true;
7611
elproto.attr = function (name, value) {
7617
for (var a in this.attrs) if (this.attrs[has](a)) {
7618
res[a] = this.attrs[a];
7620
res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
7621
res.transform = this._.transform;
7624
if (value == null && R.is(name, "string")) {
7625
if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
7626
return this.attrs.gradient;
7628
var names = name.split(separator),
7630
for (var i = 0, ii = names.length; i < ii; i++) {
7632
if (name in this.attrs) {
7633
out[name] = this.attrs[name];
7634
} else if (R.is(this.paper.customAttributes[name], "function")) {
7635
out[name] = this.paper.customAttributes[name].def;
7637
out[name] = R._availableAttrs[name];
7640
return ii - 1 ? out : out[names[0]];
7642
if (this.attrs && value == null && R.is(name, "array")) {
7644
for (i = 0, ii = name.length; i < ii; i++) {
7645
out[name[i]] = this.attr(name[i]);
7650
if (value != null) {
7652
params[name] = value;
7654
value == null && R.is(name, "object") && (params = name);
7655
for (var key in params) {
7656
eve("raphael.attr." + key + "." + this.id, this, params[key]);
7659
for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
7660
var par = this.paper.customAttributes[key].apply(this, [].concat(params[key]));
7661
this.attrs[key] = params[key];
7662
for (var subkey in par) if (par[has](subkey)) {
7663
params[subkey] = par[subkey];
7667
if (params.text && this.type == "text") {
7668
this.textpath.string = params.text;
7670
setFillAndStroke(this, params);
7675
elproto.toFront = function () {
7676
!this.removed && this.node.parentNode.appendChild(this.node);
7677
this.paper && this.paper.top != this && R._tofront(this, this.paper);
7680
elproto.toBack = function () {
7684
if (this.node.parentNode.firstChild != this.node) {
7685
this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
7686
R._toback(this, this.paper);
7690
elproto.insertAfter = function (element) {
7694
if (element.constructor == R.st.constructor) {
7695
element = element[element.length - 1];
7697
if (element.node.nextSibling) {
7698
element.node.parentNode.insertBefore(this.node, element.node.nextSibling);
7700
element.node.parentNode.appendChild(this.node);
7702
R._insertafter(this, element, this.paper);
7705
elproto.insertBefore = function (element) {
7709
if (element.constructor == R.st.constructor) {
7710
element = element[0];
7712
element.node.parentNode.insertBefore(this.node, element.node);
7713
R._insertbefore(this, element, this.paper);
7716
elproto.blur = function (size) {
7717
var s = this.node.runtimeStyle,
7719
f = f.replace(blurregexp, E);
7721
this.attrs.blur = size;
7722
s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")";
7723
s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5));
7727
delete this.attrs.blur;
7732
R._engine.path = function (pathString, vml) {
7733
var el = createNode("shape");
7734
el.style.cssText = cssDot;
7735
el.coordsize = zoom + S + zoom;
7736
el.coordorigin = vml.coordorigin;
7737
var p = new Element(el, vml),
7738
attr = {fill: "none", stroke: "#000"};
7739
pathString && (attr.path = pathString);
7743
setFillAndStroke(p, attr);
7744
vml.canvas && vml.canvas.appendChild(el);
7745
var skew = createNode("skew");
7747
el.appendChild(skew);
7752
R._engine.rect = function (vml, x, y, w, h, r) {
7753
var path = R._rectPath(x, y, w, h, r),
7754
res = vml.path(path),
7758
res.W = a.width = w;
7759
res.H = a.height = h;
7765
R._engine.ellipse = function (vml, x, y, rx, ry) {
7766
var res = vml.path(),
7772
res.type = "ellipse";
7773
setFillAndStroke(res, {
7781
R._engine.circle = function (vml, x, y, r) {
7782
var res = vml.path(),
7786
res.W = res.H = r * 2;
7787
res.type = "circle";
7788
setFillAndStroke(res, {
7795
R._engine.image = function (vml, src, x, y, w, h) {
7796
var path = R._rectPath(x, y, w, h),
7797
res = vml.path(path).attr({stroke: "none"}),
7800
fill = node.getElementsByTagName(fillString)[0];
7804
res.W = a.width = w;
7805
res.H = a.height = h;
7808
fill.parentNode == node && node.removeChild(fill);
7812
res._.fillpos = [x, y];
7813
res._.fillsize = [w, h];
7814
node.appendChild(fill);
7815
setCoords(res, 1, 1, 0, 0, 0);
7818
R._engine.text = function (vml, x, y, text) {
7819
var el = createNode("shape"),
7820
path = createNode("path"),
7821
o = createNode("textpath");
7825
path.v = R.format("m{0},{1}l{2},{1}", round(x * zoom), round(y * zoom), round(x * zoom) + 1);
7826
path.textpathok = true;
7827
o.string = Str(text);
7829
el.style.cssText = cssDot;
7830
el.coordsize = zoom + S + zoom;
7831
el.coordorigin = "0 0";
7832
var p = new Element(el, vml),
7836
font: R._availableAttrs.font,
7843
p.attrs.text = Str(text);
7848
setFillAndStroke(p, attr);
7850
el.appendChild(path);
7851
vml.canvas.appendChild(el);
7852
var skew = createNode("skew");
7854
el.appendChild(skew);
7859
R._engine.setSize = function (width, height) {
7860
var cs = this.canvas.style;
7862
this.height = height;
7863
width == +width && (width += "px");
7864
height == +height && (height += "px");
7867
cs.clip = "rect(0 " + width + " " + height + " 0)";
7868
if (this._viewBox) {
7869
R._engine.setViewBox.apply(this, this._viewBox);
7873
R._engine.setViewBox = function (x, y, w, h, fit) {
7874
R.eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]);
7875
var paperSize = this.getSize(),
7876
width = paperSize.width,
7877
height = paperSize.height,
7882
if (w * H < width) {
7883
x -= (width - w * H) / 2 / H;
7885
if (h * W < height) {
7886
y -= (height - h * W) / 2 / W;
7889
this._viewBox = [x, y, w, h, !!fit];
7890
this._viewBoxShift = {
7895
this.forEach(function (el) {
7896
el.transform("...");
7901
R._engine.initWin = function (win) {
7902
var doc = win.document;
7903
if (doc.styleSheets.length < 31) {
7904
doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
7908
doc.styleSheets[0].addRule(".rvml", "behavior:url(#default#VML)");
7911
!doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
7912
createNode = function (tagName) {
7913
return doc.createElement('<rvml:' + tagName + ' class="rvml">');
7916
createNode = function (tagName) {
7917
return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
7921
R._engine.initWin(R._g.win);
7922
R._engine.create = function () {
7923
var con = R._getContainer.apply(0, arguments),
7924
container = con.container,
7925
height = con.height,
7931
throw new Error("VML container not found.");
7933
var res = new R._Paper,
7934
c = res.canvas = R._g.doc.createElement("div"),
7938
width = width || 512;
7939
height = height || 342;
7941
res.height = height;
7942
width == +width && (width += "px");
7943
height == +height && (height += "px");
7944
res.coordsize = zoom * 1e3 + S + zoom * 1e3;
7945
res.coordorigin = "0 0";
7946
res.span = R._g.doc.createElement("span");
7947
res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";
7948
c.appendChild(res.span);
7949
cs.cssText = R.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
7950
if (container == 1) {
7951
R._g.doc.body.appendChild(c);
7954
cs.position = "absolute";
7956
if (container.firstChild) {
7957
container.insertBefore(c, container.firstChild);
7959
container.appendChild(c);
7962
res.renderfix = function () {};
7965
R.prototype.clear = function () {
7966
R.eve("raphael.clear", this);
7967
this.canvas.innerHTML = E;
7968
this.span = R._g.doc.createElement("span");
7969
this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
7970
this.canvas.appendChild(this.span);
7971
this.bottom = this.top = null;
7973
R.prototype.remove = function () {
7974
R.eve("raphael.remove", this);
7975
this.canvas.parentNode.removeChild(this.canvas);
7976
for (var i in this) {
7977
this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
7982
var setproto = R.st;
7983
for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
7984
setproto[method] = (function (methodname) {
7985
return function () {
7986
var arg = arguments;
7987
return this.forEach(function (el) {
7988
el[methodname].apply(el, arg);
7993
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
7994
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
8004
(function(module, exports) {
8006
module.exports = __WEBPACK_EXTERNAL_MODULE_eve__;