Initial import of Recruitment-HC source code
This commit is contained in:
commit
9107ffb158
18456 files changed
+2881918
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "raphael",
|
||||
"main": "raphael.min.js",
|
||||
"description": "JavaScript Vector Library",
|
||||
"dependencies": {
|
||||
"eve-raphael": "0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": "2.3.2"
|
||||
},
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"svg",
|
||||
"vml",
|
||||
"javascript"
|
||||
],
|
||||
"authors": [
|
||||
"Dmitry Baranovskiy"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"*.html",
|
||||
"*.json",
|
||||
"*.markdown",
|
||||
"*.md",
|
||||
"copy.js",
|
||||
"Gruntfile.js",
|
||||
"reference.js"
|
||||
],
|
||||
"homepage": "https://github.com/DmitryBaranovskiy/raphael",
|
||||
"version": "2.2.7",
|
||||
"_release": "2.2.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v2.2.7",
|
||||
"commit": "f17a2a397af7790c8cb7313a8d3d105cb44e7f4a"
|
||||
},
|
||||
"_source": "https://github.com/DmitryBaranovskiy/raphael.git",
|
||||
"_target": ">= 2.0",
|
||||
"_originalSource": "raphael"
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "raphael",
|
||||
"main": "raphael.min.js",
|
||||
"description": "JavaScript Vector Library",
|
||||
"dependencies": {
|
||||
"eve-raphael": "0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": "2.3.2"
|
||||
},
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": ["svg", "vml", "javascript"],
|
||||
"authors": [
|
||||
"Dmitry Baranovskiy"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"*.html",
|
||||
"*.json",
|
||||
"*.markdown",
|
||||
"*.md",
|
||||
"copy.js",
|
||||
"Gruntfile.js",
|
||||
"reference.js"
|
||||
]
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// ┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël 2.2.0 - JavaScript Vector Library │ \\
|
||||
// ├───────────────────────────────────────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Copyright © 2008-2016 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
|
||||
// │ Copyright © 2008-2016 Sencha Labs (http://sencha.com) │ \\
|
||||
// ├───────────────────────────────────────────────────────────────────────────────────────────────────────┤ \\
|
||||
// │ Licensed under the MIT (https://github.com/DmitryBaranovskiy/raphael/blob/master/license.txt) license.│ \\
|
||||
// └───────────────────────────────────────────────────────────────────────────────────────────────────────┘ \\
|
||||
@@ -0,0 +1,5 @@
|
||||
define(["./raphael.core", "./raphael.svg", "./raphael.vml"], function(R) {
|
||||
|
||||
return R;
|
||||
|
||||
});
|
||||
+5405
File diff suppressed because it is too large.
Load diff
+1424
File diff suppressed because it is too large.
Load diff
+999
@@ -0,0 +1,999 @@
|
||||
define(["./raphael.core"], function(R) {
|
||||
if (R && !R.vml) {
|
||||
return;
|
||||
}
|
||||
|
||||
var has = "hasOwnProperty",
|
||||
Str = String,
|
||||
toFloat = parseFloat,
|
||||
math = Math,
|
||||
round = math.round,
|
||||
mmax = math.max,
|
||||
mmin = math.min,
|
||||
abs = math.abs,
|
||||
fillString = "fill",
|
||||
separator = /[, ]+/,
|
||||
eve = R.eve,
|
||||
ms = " progid:DXImageTransform.Microsoft",
|
||||
S = " ",
|
||||
E = "",
|
||||
map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
|
||||
bites = /([clmz]),?([^clmz]*)/gi,
|
||||
blurregexp = / progid:\S+Blur\([^\)]+\)/g,
|
||||
val = /-?[^,\s-]+/g,
|
||||
cssDot = "position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",
|
||||
zoom = 21600,
|
||||
pathTypes = {path: 1, rect: 1, image: 1},
|
||||
ovalTypes = {circle: 1, ellipse: 1},
|
||||
path2vml = function (path) {
|
||||
var total = /[ahqstv]/ig,
|
||||
command = R._pathToAbsolute;
|
||||
Str(path).match(total) && (command = R._path2curve);
|
||||
total = /[clmz]/g;
|
||||
if (command == R._pathToAbsolute && !Str(path).match(total)) {
|
||||
var res = Str(path).replace(bites, function (all, command, args) {
|
||||
var vals = [],
|
||||
isMove = command.toLowerCase() == "m",
|
||||
res = map[command];
|
||||
args.replace(val, function (value) {
|
||||
if (isMove && vals.length == 2) {
|
||||
res += vals + map[command == "m" ? "l" : "L"];
|
||||
vals = [];
|
||||
}
|
||||
vals.push(round(value * zoom));
|
||||
});
|
||||
return res + vals;
|
||||
});
|
||||
return res;
|
||||
}
|
||||
var pa = command(path), p, r;
|
||||
res = [];
|
||||
for (var i = 0, ii = pa.length; i < ii; i++) {
|
||||
p = pa[i];
|
||||
r = pa[i][0].toLowerCase();
|
||||
r == "z" && (r = "x");
|
||||
for (var j = 1, jj = p.length; j < jj; j++) {
|
||||
r += round(p[j] * zoom) + (j != jj - 1 ? "," : E);
|
||||
}
|
||||
res.push(r);
|
||||
}
|
||||
return res.join(S);
|
||||
},
|
||||
compensation = function (deg, dx, dy) {
|
||||
var m = R.matrix();
|
||||
m.rotate(-deg, .5, .5);
|
||||
return {
|
||||
dx: m.x(dx, dy),
|
||||
dy: m.y(dx, dy)
|
||||
};
|
||||
},
|
||||
setCoords = function (p, sx, sy, dx, dy, deg) {
|
||||
var _ = p._,
|
||||
m = p.matrix,
|
||||
fillpos = _.fillpos,
|
||||
o = p.node,
|
||||
s = o.style,
|
||||
y = 1,
|
||||
flip = "",
|
||||
dxdy,
|
||||
kx = zoom / sx,
|
||||
ky = zoom / sy;
|
||||
s.visibility = "hidden";
|
||||
if (!sx || !sy) {
|
||||
return;
|
||||
}
|
||||
o.coordsize = abs(kx) + S + abs(ky);
|
||||
s.rotation = deg * (sx * sy < 0 ? -1 : 1);
|
||||
if (deg) {
|
||||
var c = compensation(deg, dx, dy);
|
||||
dx = c.dx;
|
||||
dy = c.dy;
|
||||
}
|
||||
sx < 0 && (flip += "x");
|
||||
sy < 0 && (flip += " y") && (y = -1);
|
||||
s.flip = flip;
|
||||
o.coordorigin = (dx * -kx) + S + (dy * -ky);
|
||||
if (fillpos || _.fillsize) {
|
||||
var fill = o.getElementsByTagName(fillString);
|
||||
fill = fill && fill[0];
|
||||
o.removeChild(fill);
|
||||
if (fillpos) {
|
||||
c = compensation(deg, m.x(fillpos[0], fillpos[1]), m.y(fillpos[0], fillpos[1]));
|
||||
fill.position = c.dx * y + S + c.dy * y;
|
||||
}
|
||||
if (_.fillsize) {
|
||||
fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy);
|
||||
}
|
||||
o.appendChild(fill);
|
||||
}
|
||||
s.visibility = "visible";
|
||||
};
|
||||
R.toString = function () {
|
||||
return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
|
||||
};
|
||||
var addArrow = function (o, value, isEnd) {
|
||||
var values = Str(value).toLowerCase().split("-"),
|
||||
se = isEnd ? "end" : "start",
|
||||
i = values.length,
|
||||
type = "classic",
|
||||
w = "medium",
|
||||
h = "medium";
|
||||
while (i--) {
|
||||
switch (values[i]) {
|
||||
case "block":
|
||||
case "classic":
|
||||
case "oval":
|
||||
case "diamond":
|
||||
case "open":
|
||||
case "none":
|
||||
type = values[i];
|
||||
break;
|
||||
case "wide":
|
||||
case "narrow": h = values[i]; break;
|
||||
case "long":
|
||||
case "short": w = values[i]; break;
|
||||
}
|
||||
}
|
||||
var stroke = o.node.getElementsByTagName("stroke")[0];
|
||||
stroke[se + "arrow"] = type;
|
||||
stroke[se + "arrowlength"] = w;
|
||||
stroke[se + "arrowwidth"] = h;
|
||||
},
|
||||
setFillAndStroke = function (o, params) {
|
||||
// o.paper.canvas.style.display = "none";
|
||||
o.attrs = o.attrs || {};
|
||||
var node = o.node,
|
||||
a = o.attrs,
|
||||
s = node.style,
|
||||
xy,
|
||||
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),
|
||||
isOval = ovalTypes[o.type] && (a.cx != params.cx || a.cy != params.cy || a.r != params.r || a.rx != params.rx || a.ry != params.ry),
|
||||
res = o;
|
||||
|
||||
|
||||
for (var par in params) if (params[has](par)) {
|
||||
a[par] = params[par];
|
||||
}
|
||||
if (newpath) {
|
||||
a.path = R._getPath[o.type](o);
|
||||
o._.dirty = 1;
|
||||
}
|
||||
params.href && (node.href = params.href);
|
||||
params.title && (node.title = params.title);
|
||||
params.target && (node.target = params.target);
|
||||
params.cursor && (s.cursor = params.cursor);
|
||||
"blur" in params && o.blur(params.blur);
|
||||
if (params.path && o.type == "path" || newpath) {
|
||||
node.path = path2vml(~Str(a.path).toLowerCase().indexOf("r") ? R._pathToAbsolute(a.path) : a.path);
|
||||
o._.dirty = 1;
|
||||
if (o.type == "image") {
|
||||
o._.fillpos = [a.x, a.y];
|
||||
o._.fillsize = [a.width, a.height];
|
||||
setCoords(o, 1, 1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
"transform" in params && o.transform(params.transform);
|
||||
if (isOval) {
|
||||
var cx = +a.cx,
|
||||
cy = +a.cy,
|
||||
rx = +a.rx || +a.r || 0,
|
||||
ry = +a.ry || +a.r || 0;
|
||||
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));
|
||||
o._.dirty = 1;
|
||||
}
|
||||
if ("clip-rect" in params) {
|
||||
var rect = Str(params["clip-rect"]).split(separator);
|
||||
if (rect.length == 4) {
|
||||
rect[2] = +rect[2] + (+rect[0]);
|
||||
rect[3] = +rect[3] + (+rect[1]);
|
||||
var div = node.clipRect || R._g.doc.createElement("div"),
|
||||
dstyle = div.style;
|
||||
dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
|
||||
if (!node.clipRect) {
|
||||
dstyle.position = "absolute";
|
||||
dstyle.top = 0;
|
||||
dstyle.left = 0;
|
||||
dstyle.width = o.paper.width + "px";
|
||||
dstyle.height = o.paper.height + "px";
|
||||
node.parentNode.insertBefore(div, node);
|
||||
div.appendChild(node);
|
||||
node.clipRect = div;
|
||||
}
|
||||
}
|
||||
if (!params["clip-rect"]) {
|
||||
node.clipRect && (node.clipRect.style.clip = "auto");
|
||||
}
|
||||
}
|
||||
if (o.textpath) {
|
||||
var textpathStyle = o.textpath.style;
|
||||
params.font && (textpathStyle.font = params.font);
|
||||
params["font-family"] && (textpathStyle.fontFamily = '"' + params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, E) + '"');
|
||||
params["font-size"] && (textpathStyle.fontSize = params["font-size"]);
|
||||
params["font-weight"] && (textpathStyle.fontWeight = params["font-weight"]);
|
||||
params["font-style"] && (textpathStyle.fontStyle = params["font-style"]);
|
||||
}
|
||||
if ("arrow-start" in params) {
|
||||
addArrow(res, params["arrow-start"]);
|
||||
}
|
||||
if ("arrow-end" in params) {
|
||||
addArrow(res, params["arrow-end"], 1);
|
||||
}
|
||||
if (params.opacity != null ||
|
||||
params.fill != null ||
|
||||
params.src != null ||
|
||||
params.stroke != null ||
|
||||
params["stroke-width"] != null ||
|
||||
params["stroke-opacity"] != null ||
|
||||
params["fill-opacity"] != null ||
|
||||
params["stroke-dasharray"] != null ||
|
||||
params["stroke-miterlimit"] != null ||
|
||||
params["stroke-linejoin"] != null ||
|
||||
params["stroke-linecap"] != null) {
|
||||
var fill = node.getElementsByTagName(fillString),
|
||||
newfill = false;
|
||||
fill = fill && fill[0];
|
||||
!fill && (newfill = fill = createNode(fillString));
|
||||
if (o.type == "image" && params.src) {
|
||||
fill.src = params.src;
|
||||
}
|
||||
params.fill && (fill.on = true);
|
||||
if (fill.on == null || params.fill == "none" || params.fill === null) {
|
||||
fill.on = false;
|
||||
}
|
||||
if (fill.on && params.fill) {
|
||||
var isURL = Str(params.fill).match(R._ISURL);
|
||||
if (isURL) {
|
||||
fill.parentNode == node && node.removeChild(fill);
|
||||
fill.rotate = true;
|
||||
fill.src = isURL[1];
|
||||
fill.type = "tile";
|
||||
var bbox = o.getBBox(1);
|
||||
fill.position = bbox.x + S + bbox.y;
|
||||
o._.fillpos = [bbox.x, bbox.y];
|
||||
|
||||
R._preload(isURL[1], function () {
|
||||
o._.fillsize = [this.offsetWidth, this.offsetHeight];
|
||||
});
|
||||
} else {
|
||||
fill.color = R.getRGB(params.fill).hex;
|
||||
fill.src = E;
|
||||
fill.type = "solid";
|
||||
if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill, fill)) {
|
||||
a.fill = "none";
|
||||
a.gradient = params.fill;
|
||||
fill.rotate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("fill-opacity" in params || "opacity" in params) {
|
||||
var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
|
||||
opacity = mmin(mmax(opacity, 0), 1);
|
||||
fill.opacity = opacity;
|
||||
if (fill.src) {
|
||||
fill.color = "none";
|
||||
}
|
||||
}
|
||||
node.appendChild(fill);
|
||||
var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]),
|
||||
newstroke = false;
|
||||
!stroke && (newstroke = stroke = createNode("stroke"));
|
||||
if ((params.stroke && params.stroke != "none") ||
|
||||
params["stroke-width"] ||
|
||||
params["stroke-opacity"] != null ||
|
||||
params["stroke-dasharray"] ||
|
||||
params["stroke-miterlimit"] ||
|
||||
params["stroke-linejoin"] ||
|
||||
params["stroke-linecap"]) {
|
||||
stroke.on = true;
|
||||
}
|
||||
(params.stroke == "none" || params.stroke === null || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false);
|
||||
var strokeColor = R.getRGB(params.stroke);
|
||||
stroke.on && params.stroke && (stroke.color = strokeColor.hex);
|
||||
opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
|
||||
var width = (toFloat(params["stroke-width"]) || 1) * .75;
|
||||
opacity = mmin(mmax(opacity, 0), 1);
|
||||
params["stroke-width"] == null && (width = a["stroke-width"]);
|
||||
params["stroke-width"] && (stroke.weight = width);
|
||||
width && width < 1 && (opacity *= width) && (stroke.weight = 1);
|
||||
stroke.opacity = opacity;
|
||||
|
||||
params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
|
||||
stroke.miterlimit = params["stroke-miterlimit"] || 8;
|
||||
params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
|
||||
if ("stroke-dasharray" in params) {
|
||||
var dasharray = {
|
||||
"-": "shortdash",
|
||||
".": "shortdot",
|
||||
"-.": "shortdashdot",
|
||||
"-..": "shortdashdotdot",
|
||||
". ": "dot",
|
||||
"- ": "dash",
|
||||
"--": "longdash",
|
||||
"- .": "dashdot",
|
||||
"--.": "longdashdot",
|
||||
"--..": "longdashdotdot"
|
||||
};
|
||||
stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E;
|
||||
}
|
||||
newstroke && node.appendChild(stroke);
|
||||
}
|
||||
if (res.type == "text") {
|
||||
res.paper.canvas.style.display = E;
|
||||
var span = res.paper.span,
|
||||
m = 100,
|
||||
fontSize = a.font && a.font.match(/\d+(?:\.\d*)?(?=px)/);
|
||||
s = span.style;
|
||||
a.font && (s.font = a.font);
|
||||
a["font-family"] && (s.fontFamily = a["font-family"]);
|
||||
a["font-weight"] && (s.fontWeight = a["font-weight"]);
|
||||
a["font-style"] && (s.fontStyle = a["font-style"]);
|
||||
fontSize = toFloat(a["font-size"] || fontSize && fontSize[0]) || 10;
|
||||
s.fontSize = fontSize * m + "px";
|
||||
res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, "<br>"));
|
||||
var brect = span.getBoundingClientRect();
|
||||
res.W = a.w = (brect.right - brect.left) / m;
|
||||
res.H = a.h = (brect.bottom - brect.top) / m;
|
||||
// res.paper.canvas.style.display = "none";
|
||||
res.X = a.x;
|
||||
res.Y = a.y + res.H / 2;
|
||||
|
||||
("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));
|
||||
var dirtyattrs = ["x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size"];
|
||||
for (var d = 0, dd = dirtyattrs.length; d < dd; d++) if (dirtyattrs[d] in params) {
|
||||
res._.dirty = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// text-anchor emulation
|
||||
switch (a["text-anchor"]) {
|
||||
case "start":
|
||||
res.textpath.style["v-text-align"] = "left";
|
||||
res.bbx = res.W / 2;
|
||||
break;
|
||||
case "end":
|
||||
res.textpath.style["v-text-align"] = "right";
|
||||
res.bbx = -res.W / 2;
|
||||
break;
|
||||
default:
|
||||
res.textpath.style["v-text-align"] = "center";
|
||||
res.bbx = 0;
|
||||
break;
|
||||
}
|
||||
res.textpath.style["v-text-kern"] = true;
|
||||
}
|
||||
// res.paper.canvas.style.display = E;
|
||||
},
|
||||
addGradientFill = function (o, gradient, fill) {
|
||||
o.attrs = o.attrs || {};
|
||||
var attrs = o.attrs,
|
||||
pow = Math.pow,
|
||||
opacity,
|
||||
oindex,
|
||||
type = "linear",
|
||||
fxfy = ".5 .5";
|
||||
o.attrs.gradient = gradient;
|
||||
gradient = Str(gradient).replace(R._radial_gradient, function (all, fx, fy) {
|
||||
type = "radial";
|
||||
if (fx && fy) {
|
||||
fx = toFloat(fx);
|
||||
fy = toFloat(fy);
|
||||
pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5);
|
||||
fxfy = fx + S + fy;
|
||||
}
|
||||
return E;
|
||||
});
|
||||
gradient = gradient.split(/\s*\-\s*/);
|
||||
if (type == "linear") {
|
||||
var angle = gradient.shift();
|
||||
angle = -toFloat(angle);
|
||||
if (isNaN(angle)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
var dots = R._parseDots(gradient);
|
||||
if (!dots) {
|
||||
return null;
|
||||
}
|
||||
o = o.shape || o.node;
|
||||
if (dots.length) {
|
||||
o.removeChild(fill);
|
||||
fill.on = true;
|
||||
fill.method = "none";
|
||||
fill.color = dots[0].color;
|
||||
fill.color2 = dots[dots.length - 1].color;
|
||||
var clrs = [];
|
||||
for (var i = 0, ii = dots.length; i < ii; i++) {
|
||||
dots[i].offset && clrs.push(dots[i].offset + S + dots[i].color);
|
||||
}
|
||||
fill.colors = clrs.length ? clrs.join() : "0% " + fill.color;
|
||||
if (type == "radial") {
|
||||
fill.type = "gradientTitle";
|
||||
fill.focus = "100%";
|
||||
fill.focussize = "0 0";
|
||||
fill.focusposition = fxfy;
|
||||
fill.angle = 0;
|
||||
} else {
|
||||
// fill.rotate= true;
|
||||
fill.type = "gradient";
|
||||
fill.angle = (270 - angle) % 360;
|
||||
}
|
||||
o.appendChild(fill);
|
||||
}
|
||||
return 1;
|
||||
},
|
||||
Element = function (node, vml) {
|
||||
this[0] = this.node = node;
|
||||
node.raphael = true;
|
||||
this.id = R._oid++;
|
||||
node.raphaelid = this.id;
|
||||
this.X = 0;
|
||||
this.Y = 0;
|
||||
this.attrs = {};
|
||||
this.paper = vml;
|
||||
this.matrix = R.matrix();
|
||||
this._ = {
|
||||
transform: [],
|
||||
sx: 1,
|
||||
sy: 1,
|
||||
dx: 0,
|
||||
dy: 0,
|
||||
deg: 0,
|
||||
dirty: 1,
|
||||
dirtyT: 1
|
||||
};
|
||||
!vml.bottom && (vml.bottom = this);
|
||||
this.prev = vml.top;
|
||||
vml.top && (vml.top.next = this);
|
||||
vml.top = this;
|
||||
this.next = null;
|
||||
};
|
||||
var elproto = R.el;
|
||||
|
||||
Element.prototype = elproto;
|
||||
elproto.constructor = Element;
|
||||
elproto.transform = function (tstr) {
|
||||
if (tstr == null) {
|
||||
return this._.transform;
|
||||
}
|
||||
var vbs = this.paper._viewBoxShift,
|
||||
vbt = vbs ? "s" + [vbs.scale, vbs.scale] + "-1-1t" + [vbs.dx, vbs.dy] : E,
|
||||
oldt;
|
||||
if (vbs) {
|
||||
oldt = tstr = Str(tstr).replace(/\.{3}|\u2026/g, this._.transform || E);
|
||||
}
|
||||
R._extractTransform(this, vbt + tstr);
|
||||
var matrix = this.matrix.clone(),
|
||||
skew = this.skew,
|
||||
o = this.node,
|
||||
split,
|
||||
isGrad = ~Str(this.attrs.fill).indexOf("-"),
|
||||
isPatt = !Str(this.attrs.fill).indexOf("url(");
|
||||
matrix.translate(1, 1);
|
||||
if (isPatt || isGrad || this.type == "image") {
|
||||
skew.matrix = "1 0 0 1";
|
||||
skew.offset = "0 0";
|
||||
split = matrix.split();
|
||||
if ((isGrad && split.noRotation) || !split.isSimple) {
|
||||
o.style.filter = matrix.toFilter();
|
||||
var bb = this.getBBox(),
|
||||
bbt = this.getBBox(1),
|
||||
dx = bb.x - bbt.x,
|
||||
dy = bb.y - bbt.y;
|
||||
o.coordorigin = (dx * -zoom) + S + (dy * -zoom);
|
||||
setCoords(this, 1, 1, dx, dy, 0);
|
||||
} else {
|
||||
o.style.filter = E;
|
||||
setCoords(this, split.scalex, split.scaley, split.dx, split.dy, split.rotate);
|
||||
}
|
||||
} else {
|
||||
o.style.filter = E;
|
||||
skew.matrix = Str(matrix);
|
||||
skew.offset = matrix.offset();
|
||||
}
|
||||
if (oldt !== null) { // empty string value is true as well
|
||||
this._.transform = oldt;
|
||||
R._extractTransform(this, oldt);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
elproto.rotate = function (deg, cx, cy) {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
if (deg == null) {
|
||||
return;
|
||||
}
|
||||
deg = Str(deg).split(separator);
|
||||
if (deg.length - 1) {
|
||||
cx = toFloat(deg[1]);
|
||||
cy = toFloat(deg[2]);
|
||||
}
|
||||
deg = toFloat(deg[0]);
|
||||
(cy == null) && (cx = cy);
|
||||
if (cx == null || cy == null) {
|
||||
var bbox = this.getBBox(1);
|
||||
cx = bbox.x + bbox.width / 2;
|
||||
cy = bbox.y + bbox.height / 2;
|
||||
}
|
||||
this._.dirtyT = 1;
|
||||
this.transform(this._.transform.concat([["r", deg, cx, cy]]));
|
||||
return this;
|
||||
};
|
||||
elproto.translate = function (dx, dy) {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
dx = Str(dx).split(separator);
|
||||
if (dx.length - 1) {
|
||||
dy = toFloat(dx[1]);
|
||||
}
|
||||
dx = toFloat(dx[0]) || 0;
|
||||
dy = +dy || 0;
|
||||
if (this._.bbox) {
|
||||
this._.bbox.x += dx;
|
||||
this._.bbox.y += dy;
|
||||
}
|
||||
this.transform(this._.transform.concat([["t", dx, dy]]));
|
||||
return this;
|
||||
};
|
||||
elproto.scale = function (sx, sy, cx, cy) {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
sx = Str(sx).split(separator);
|
||||
if (sx.length - 1) {
|
||||
sy = toFloat(sx[1]);
|
||||
cx = toFloat(sx[2]);
|
||||
cy = toFloat(sx[3]);
|
||||
isNaN(cx) && (cx = null);
|
||||
isNaN(cy) && (cy = null);
|
||||
}
|
||||
sx = toFloat(sx[0]);
|
||||
(sy == null) && (sy = sx);
|
||||
(cy == null) && (cx = cy);
|
||||
if (cx == null || cy == null) {
|
||||
var bbox = this.getBBox(1);
|
||||
}
|
||||
cx = cx == null ? bbox.x + bbox.width / 2 : cx;
|
||||
cy = cy == null ? bbox.y + bbox.height / 2 : cy;
|
||||
|
||||
this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
|
||||
this._.dirtyT = 1;
|
||||
return this;
|
||||
};
|
||||
elproto.hide = function () {
|
||||
!this.removed && (this.node.style.display = "none");
|
||||
return this;
|
||||
};
|
||||
elproto.show = function () {
|
||||
!this.removed && (this.node.style.display = E);
|
||||
return this;
|
||||
};
|
||||
// Needed to fix the vml setViewBox issues
|
||||
elproto.auxGetBBox = R.el.getBBox;
|
||||
elproto.getBBox = function(){
|
||||
var b = this.auxGetBBox();
|
||||
if (this.paper && this.paper._viewBoxShift)
|
||||
{
|
||||
var c = {};
|
||||
var z = 1/this.paper._viewBoxShift.scale;
|
||||
c.x = b.x - this.paper._viewBoxShift.dx;
|
||||
c.x *= z;
|
||||
c.y = b.y - this.paper._viewBoxShift.dy;
|
||||
c.y *= z;
|
||||
c.width = b.width * z;
|
||||
c.height = b.height * z;
|
||||
c.x2 = c.x + c.width;
|
||||
c.y2 = c.y + c.height;
|
||||
return c;
|
||||
}
|
||||
return b;
|
||||
};
|
||||
elproto._getBBox = function () {
|
||||
if (this.removed) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
x: this.X + (this.bbx || 0) - this.W / 2,
|
||||
y: this.Y - this.H,
|
||||
width: this.W,
|
||||
height: this.H
|
||||
};
|
||||
};
|
||||
elproto.remove = function () {
|
||||
if (this.removed || !this.node.parentNode) {
|
||||
return;
|
||||
}
|
||||
this.paper.__set__ && this.paper.__set__.exclude(this);
|
||||
R.eve.unbind("raphael.*.*." + this.id);
|
||||
R._tear(this, this.paper);
|
||||
this.node.parentNode.removeChild(this.node);
|
||||
this.shape && this.shape.parentNode.removeChild(this.shape);
|
||||
for (var i in this) {
|
||||
this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
|
||||
}
|
||||
this.removed = true;
|
||||
};
|
||||
elproto.attr = function (name, value) {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
if (name == null) {
|
||||
var res = {};
|
||||
for (var a in this.attrs) if (this.attrs[has](a)) {
|
||||
res[a] = this.attrs[a];
|
||||
}
|
||||
res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
|
||||
res.transform = this._.transform;
|
||||
return res;
|
||||
}
|
||||
if (value == null && R.is(name, "string")) {
|
||||
if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
|
||||
return this.attrs.gradient;
|
||||
}
|
||||
var names = name.split(separator),
|
||||
out = {};
|
||||
for (var i = 0, ii = names.length; i < ii; i++) {
|
||||
name = names[i];
|
||||
if (name in this.attrs) {
|
||||
out[name] = this.attrs[name];
|
||||
} else if (R.is(this.paper.customAttributes[name], "function")) {
|
||||
out[name] = this.paper.customAttributes[name].def;
|
||||
} else {
|
||||
out[name] = R._availableAttrs[name];
|
||||
}
|
||||
}
|
||||
return ii - 1 ? out : out[names[0]];
|
||||
}
|
||||
if (this.attrs && value == null && R.is(name, "array")) {
|
||||
out = {};
|
||||
for (i = 0, ii = name.length; i < ii; i++) {
|
||||
out[name[i]] = this.attr(name[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
var params;
|
||||
if (value != null) {
|
||||
params = {};
|
||||
params[name] = value;
|
||||
}
|
||||
value == null && R.is(name, "object") && (params = name);
|
||||
for (var key in params) {
|
||||
eve("raphael.attr." + key + "." + this.id, this, params[key]);
|
||||
}
|
||||
if (params) {
|
||||
for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
|
||||
var par = this.paper.customAttributes[key].apply(this, [].concat(params[key]));
|
||||
this.attrs[key] = params[key];
|
||||
for (var subkey in par) if (par[has](subkey)) {
|
||||
params[subkey] = par[subkey];
|
||||
}
|
||||
}
|
||||
// this.paper.canvas.style.display = "none";
|
||||
if (params.text && this.type == "text") {
|
||||
this.textpath.string = params.text;
|
||||
}
|
||||
setFillAndStroke(this, params);
|
||||
// this.paper.canvas.style.display = E;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
elproto.toFront = function () {
|
||||
!this.removed && this.node.parentNode.appendChild(this.node);
|
||||
this.paper && this.paper.top != this && R._tofront(this, this.paper);
|
||||
return this;
|
||||
};
|
||||
elproto.toBack = function () {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
if (this.node.parentNode.firstChild != this.node) {
|
||||
this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
|
||||
R._toback(this, this.paper);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
elproto.insertAfter = function (element) {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
if (element.constructor == R.st.constructor) {
|
||||
element = element[element.length - 1];
|
||||
}
|
||||
if (element.node.nextSibling) {
|
||||
element.node.parentNode.insertBefore(this.node, element.node.nextSibling);
|
||||
} else {
|
||||
element.node.parentNode.appendChild(this.node);
|
||||
}
|
||||
R._insertafter(this, element, this.paper);
|
||||
return this;
|
||||
};
|
||||
elproto.insertBefore = function (element) {
|
||||
if (this.removed) {
|
||||
return this;
|
||||
}
|
||||
if (element.constructor == R.st.constructor) {
|
||||
element = element[0];
|
||||
}
|
||||
element.node.parentNode.insertBefore(this.node, element.node);
|
||||
R._insertbefore(this, element, this.paper);
|
||||
return this;
|
||||
};
|
||||
elproto.blur = function (size) {
|
||||
var s = this.node.runtimeStyle,
|
||||
f = s.filter;
|
||||
f = f.replace(blurregexp, E);
|
||||
if (+size !== 0) {
|
||||
this.attrs.blur = size;
|
||||
s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")";
|
||||
s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5));
|
||||
} else {
|
||||
s.filter = f;
|
||||
s.margin = 0;
|
||||
delete this.attrs.blur;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
R._engine.path = function (pathString, vml) {
|
||||
var el = createNode("shape");
|
||||
el.style.cssText = cssDot;
|
||||
el.coordsize = zoom + S + zoom;
|
||||
el.coordorigin = vml.coordorigin;
|
||||
var p = new Element(el, vml),
|
||||
attr = {fill: "none", stroke: "#000"};
|
||||
pathString && (attr.path = pathString);
|
||||
p.type = "path";
|
||||
p.path = [];
|
||||
p.Path = E;
|
||||
setFillAndStroke(p, attr);
|
||||
vml.canvas && vml.canvas.appendChild(el);
|
||||
var skew = createNode("skew");
|
||||
skew.on = true;
|
||||
el.appendChild(skew);
|
||||
p.skew = skew;
|
||||
p.transform(E);
|
||||
return p;
|
||||
};
|
||||
R._engine.rect = function (vml, x, y, w, h, r) {
|
||||
var path = R._rectPath(x, y, w, h, r),
|
||||
res = vml.path(path),
|
||||
a = res.attrs;
|
||||
res.X = a.x = x;
|
||||
res.Y = a.y = y;
|
||||
res.W = a.width = w;
|
||||
res.H = a.height = h;
|
||||
a.r = r;
|
||||
a.path = path;
|
||||
res.type = "rect";
|
||||
return res;
|
||||
};
|
||||
R._engine.ellipse = function (vml, x, y, rx, ry) {
|
||||
var res = vml.path(),
|
||||
a = res.attrs;
|
||||
res.X = x - rx;
|
||||
res.Y = y - ry;
|
||||
res.W = rx * 2;
|
||||
res.H = ry * 2;
|
||||
res.type = "ellipse";
|
||||
setFillAndStroke(res, {
|
||||
cx: x,
|
||||
cy: y,
|
||||
rx: rx,
|
||||
ry: ry
|
||||
});
|
||||
return res;
|
||||
};
|
||||
R._engine.circle = function (vml, x, y, r) {
|
||||
var res = vml.path(),
|
||||
a = res.attrs;
|
||||
res.X = x - r;
|
||||
res.Y = y - r;
|
||||
res.W = res.H = r * 2;
|
||||
res.type = "circle";
|
||||
setFillAndStroke(res, {
|
||||
cx: x,
|
||||
cy: y,
|
||||
r: r
|
||||
});
|
||||
return res;
|
||||
};
|
||||
R._engine.image = function (vml, src, x, y, w, h) {
|
||||
var path = R._rectPath(x, y, w, h),
|
||||
res = vml.path(path).attr({stroke: "none"}),
|
||||
a = res.attrs,
|
||||
node = res.node,
|
||||
fill = node.getElementsByTagName(fillString)[0];
|
||||
a.src = src;
|
||||
res.X = a.x = x;
|
||||
res.Y = a.y = y;
|
||||
res.W = a.width = w;
|
||||
res.H = a.height = h;
|
||||
a.path = path;
|
||||
res.type = "image";
|
||||
fill.parentNode == node && node.removeChild(fill);
|
||||
fill.rotate = true;
|
||||
fill.src = src;
|
||||
fill.type = "tile";
|
||||
res._.fillpos = [x, y];
|
||||
res._.fillsize = [w, h];
|
||||
node.appendChild(fill);
|
||||
setCoords(res, 1, 1, 0, 0, 0);
|
||||
return res;
|
||||
};
|
||||
R._engine.text = function (vml, x, y, text) {
|
||||
var el = createNode("shape"),
|
||||
path = createNode("path"),
|
||||
o = createNode("textpath");
|
||||
x = x || 0;
|
||||
y = y || 0;
|
||||
text = text || "";
|
||||
path.v = R.format("m{0},{1}l{2},{1}", round(x * zoom), round(y * zoom), round(x * zoom) + 1);
|
||||
path.textpathok = true;
|
||||
o.string = Str(text);
|
||||
o.on = true;
|
||||
el.style.cssText = cssDot;
|
||||
el.coordsize = zoom + S + zoom;
|
||||
el.coordorigin = "0 0";
|
||||
var p = new Element(el, vml),
|
||||
attr = {
|
||||
fill: "#000",
|
||||
stroke: "none",
|
||||
font: R._availableAttrs.font,
|
||||
text: text
|
||||
};
|
||||
p.shape = el;
|
||||
p.path = path;
|
||||
p.textpath = o;
|
||||
p.type = "text";
|
||||
p.attrs.text = Str(text);
|
||||
p.attrs.x = x;
|
||||
p.attrs.y = y;
|
||||
p.attrs.w = 1;
|
||||
p.attrs.h = 1;
|
||||
setFillAndStroke(p, attr);
|
||||
el.appendChild(o);
|
||||
el.appendChild(path);
|
||||
vml.canvas.appendChild(el);
|
||||
var skew = createNode("skew");
|
||||
skew.on = true;
|
||||
el.appendChild(skew);
|
||||
p.skew = skew;
|
||||
p.transform(E);
|
||||
return p;
|
||||
};
|
||||
R._engine.setSize = function (width, height) {
|
||||
var cs = this.canvas.style;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
width == +width && (width += "px");
|
||||
height == +height && (height += "px");
|
||||
cs.width = width;
|
||||
cs.height = height;
|
||||
cs.clip = "rect(0 " + width + " " + height + " 0)";
|
||||
if (this._viewBox) {
|
||||
R._engine.setViewBox.apply(this, this._viewBox);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
R._engine.setViewBox = function (x, y, w, h, fit) {
|
||||
R.eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]);
|
||||
var paperSize = this.getSize(),
|
||||
width = paperSize.width,
|
||||
height = paperSize.height,
|
||||
H, W;
|
||||
if (fit) {
|
||||
H = height / h;
|
||||
W = width / w;
|
||||
if (w * H < width) {
|
||||
x -= (width - w * H) / 2 / H;
|
||||
}
|
||||
if (h * W < height) {
|
||||
y -= (height - h * W) / 2 / W;
|
||||
}
|
||||
}
|
||||
this._viewBox = [x, y, w, h, !!fit];
|
||||
this._viewBoxShift = {
|
||||
dx: -x,
|
||||
dy: -y,
|
||||
scale: paperSize
|
||||
};
|
||||
this.forEach(function (el) {
|
||||
el.transform("...");
|
||||
});
|
||||
return this;
|
||||
};
|
||||
var createNode;
|
||||
R._engine.initWin = function (win) {
|
||||
var doc = win.document;
|
||||
if (doc.styleSheets.length < 31) {
|
||||
doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
|
||||
} else {
|
||||
// no more room, add to the existing one
|
||||
// http://msdn.microsoft.com/en-us/library/ms531194%28VS.85%29.aspx
|
||||
doc.styleSheets[0].addRule(".rvml", "behavior:url(#default#VML)");
|
||||
}
|
||||
try {
|
||||
!doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
|
||||
createNode = function (tagName) {
|
||||
return doc.createElement('<rvml:' + tagName + ' class="rvml">');
|
||||
};
|
||||
} catch (e) {
|
||||
createNode = function (tagName) {
|
||||
return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
|
||||
};
|
||||
}
|
||||
};
|
||||
R._engine.initWin(R._g.win);
|
||||
R._engine.create = function () {
|
||||
var con = R._getContainer.apply(0, arguments),
|
||||
container = con.container,
|
||||
height = con.height,
|
||||
s,
|
||||
width = con.width,
|
||||
x = con.x,
|
||||
y = con.y;
|
||||
if (!container) {
|
||||
throw new Error("VML container not found.");
|
||||
}
|
||||
var res = new R._Paper,
|
||||
c = res.canvas = R._g.doc.createElement("div"),
|
||||
cs = c.style;
|
||||
x = x || 0;
|
||||
y = y || 0;
|
||||
width = width || 512;
|
||||
height = height || 342;
|
||||
res.width = width;
|
||||
res.height = height;
|
||||
width == +width && (width += "px");
|
||||
height == +height && (height += "px");
|
||||
res.coordsize = zoom * 1e3 + S + zoom * 1e3;
|
||||
res.coordorigin = "0 0";
|
||||
res.span = R._g.doc.createElement("span");
|
||||
res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";
|
||||
c.appendChild(res.span);
|
||||
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);
|
||||
if (container == 1) {
|
||||
R._g.doc.body.appendChild(c);
|
||||
cs.left = x + "px";
|
||||
cs.top = y + "px";
|
||||
cs.position = "absolute";
|
||||
} else {
|
||||
if (container.firstChild) {
|
||||
container.insertBefore(c, container.firstChild);
|
||||
} else {
|
||||
container.appendChild(c);
|
||||
}
|
||||
}
|
||||
res.renderfix = function () {};
|
||||
return res;
|
||||
};
|
||||
R.prototype.clear = function () {
|
||||
R.eve("raphael.clear", this);
|
||||
this.canvas.innerHTML = E;
|
||||
this.span = R._g.doc.createElement("span");
|
||||
this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
|
||||
this.canvas.appendChild(this.span);
|
||||
this.bottom = this.top = null;
|
||||
};
|
||||
R.prototype.remove = function () {
|
||||
R.eve("raphael.remove", this);
|
||||
this.canvas.parentNode.removeChild(this.canvas);
|
||||
for (var i in this) {
|
||||
this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
var setproto = R.st;
|
||||
for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
|
||||
setproto[method] = (function (methodname) {
|
||||
return function () {
|
||||
var arg = arguments;
|
||||
return this.forEach(function (el) {
|
||||
el[methodname].apply(el, arg);
|
||||
});
|
||||
};
|
||||
})(method);
|
||||
}
|
||||
});
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
(function() {
|
||||
|
||||
var paper,
|
||||
url = 'http://raphaeljs.com';
|
||||
|
||||
module('DOM', {
|
||||
setup: function() {
|
||||
paper = new Raphael(document.getElementById('qunit-fixture'), 1000, 1000);
|
||||
},
|
||||
teardown: function() {
|
||||
paper.remove();
|
||||
}
|
||||
});
|
||||
|
||||
var equalNodePosition = function(node, expectedParent, expectedPreviousSibling, expectedNextSibling) {
|
||||
equal(node.parentNode, expectedParent);
|
||||
equal(node.previousSibling, expectedPreviousSibling);
|
||||
equal(node.nextSibling, expectedNextSibling);
|
||||
};
|
||||
|
||||
var equalNodePositionWrapped = function(node, anchor, expectedParent, expectedPreviousSibling, expectedNextSibling) {
|
||||
equal(node.parentNode, anchor);
|
||||
equalNodePosition(anchor, expectedParent, expectedPreviousSibling, expectedNextSibling);
|
||||
};
|
||||
|
||||
// Element#insertBefore
|
||||
// --------------------
|
||||
|
||||
test('insertBefore: no element', function() {
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertBefore(null);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertBefore: first element', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertBefore(x);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, paper.defs, x.node);
|
||||
});
|
||||
|
||||
test('insertBefore: middle element', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertBefore(y);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertBefore: no element when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(null);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertBefore: first element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, x.node);
|
||||
});
|
||||
|
||||
test('insertBefore: first element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, xAnchor);
|
||||
});
|
||||
|
||||
test('insertBefore: middle element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(y);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertBefore: middle element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var y = paper.rect().attr('href', url),
|
||||
yAnchor = y.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertBefore(y);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, xAnchor, yAnchor);
|
||||
});
|
||||
|
||||
// TODO...
|
||||
// insertBefore: with set
|
||||
// insertBefore: with nested set.
|
||||
|
||||
// Element#insertAfter
|
||||
// -------------------
|
||||
|
||||
test('insertAfter: no element', function() {
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertAfter(null);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertAfter: last element', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
test('insertAfter: middle element', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertAfter: no element when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(null);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('insertAfter: last element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
test('insertAfter: last element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, xAnchor, null);
|
||||
});
|
||||
|
||||
test('insertAfter: middle element when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var y = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, y.node);
|
||||
});
|
||||
|
||||
test('insertAfter: middle element wrapped in <a> and wrapped in <a>', function() {
|
||||
var x = paper.rect().attr('href', url),
|
||||
xAnchor = x.node.parentNode;
|
||||
var y = paper.rect().attr('href', url),
|
||||
yAnchor = y.node.parentNode;
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.insertAfter(x);
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, xAnchor, yAnchor);
|
||||
});
|
||||
|
||||
// TODO...
|
||||
// insertAfter: with set
|
||||
// insertAfter: with nested set.
|
||||
|
||||
// Element#remove
|
||||
// --------------
|
||||
|
||||
test('remove: after added', function() {
|
||||
var el = paper.rect(),
|
||||
node = el.node;
|
||||
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, null);
|
||||
});
|
||||
|
||||
test('remove: when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
node = el.node,
|
||||
anchor = node.parentNode;
|
||||
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, anchor);
|
||||
equal(anchor.parentNode, null);
|
||||
});
|
||||
|
||||
test('remove: when already removed', function() {
|
||||
var el = paper.rect(),
|
||||
node = el.node;
|
||||
|
||||
el.remove();
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, null);
|
||||
});
|
||||
|
||||
test('remove: when the canvas is removed', function() {
|
||||
var el = paper.rect(),
|
||||
node = el.node;
|
||||
|
||||
paper.remove();
|
||||
el.remove();
|
||||
|
||||
equal(el.node, null);
|
||||
equal(node.parentNode, null);
|
||||
});
|
||||
|
||||
// Element#toFront
|
||||
// --------------
|
||||
|
||||
test('toFront: normal', function() {
|
||||
var el = paper.rect();
|
||||
var x = paper.rect();
|
||||
|
||||
el.toFront();
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
test('toFront: when wrapped in <a>', function() {
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
var x = paper.rect();
|
||||
|
||||
el.toFront();
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, x.node, null);
|
||||
});
|
||||
|
||||
// Element#toBack
|
||||
// --------------
|
||||
|
||||
test('toBack: normal', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect();
|
||||
|
||||
el.toBack();
|
||||
|
||||
equalNodePosition(el.node, paper.canvas, null, paper.desc);
|
||||
equalNodePosition(x.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
test('toBack: when wrapped in <a>', function() {
|
||||
var x = paper.rect();
|
||||
var el = paper.rect().attr('href', url),
|
||||
anchor = el.node.parentNode;
|
||||
|
||||
el.toBack();
|
||||
|
||||
equalNodePositionWrapped(el.node, anchor, paper.canvas, null, paper.desc);
|
||||
equalNodePosition(x.node, paper.canvas, paper.defs, null);
|
||||
});
|
||||
|
||||
|
||||
// Element#attrs
|
||||
// -------------
|
||||
|
||||
// #x
|
||||
|
||||
// #y
|
||||
|
||||
// #rx
|
||||
|
||||
// #ry
|
||||
|
||||
// #transform
|
||||
|
||||
// #title
|
||||
|
||||
// #href
|
||||
|
||||
//keep adding and testing!
|
||||
|
||||
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,5 @@
|
||||
(function() {
|
||||
|
||||
module('DOM');
|
||||
|
||||
})();
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2008-2010 Dmitry Baranovskiy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+8353
File diff suppressed because it is too large.
Load diff
+3
@@ -0,0 +1,3 @@
|
||||
!function t(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Raphael=r():e.Raphael=r()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var i,n;i=[r(1),r(3),r(4)],n=function(t){return t}.apply(e,i),!(void 0!==n&&(t.exports=n))},function(t,e,r){var i,n;i=[r(2)],n=function(t){function e(r){if(e.is(r,"function"))return w?r():t.on("raphael.DOMload",r);if(e.is(r,Q))return e._engine.create[z](e,r.splice(0,3+e.is(r[0],$))).add(r);var i=Array.prototype.slice.call(arguments,0);if(e.is(i[i.length-1],"function")){var n=i.pop();return w?n.call(e._engine.create[z](e,i)):t.on("raphael.DOMload",function(){n.call(e._engine.create[z](e,i))})}return e._engine.create[z](e,arguments)}function r(t){if("function"==typeof t||Object(t)!==t)return t;var e=new t.constructor;for(var i in t)t[A](i)&&(e[i]=r(t[i]));return e}function i(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return t.push(t.splice(r,1)[0])}function n(t,e,r){function n(){var a=Array.prototype.slice.call(arguments,0),s=a.join("␀"),o=n.cache=n.cache||{},l=n.count=n.count||[];return o[A](s)?(i(l,s),r?r(o[s]):o[s]):(l.length>=1e3&&delete o[l.shift()],l.push(s),o[s]=t[z](e,a),r?r(o[s]):o[s])}return n}function a(){return this.hex}function s(t,e){for(var r=[],i=0,n=t.length;n-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?n-4==i?a[3]={x:+t[0],y:+t[1]}:n-2==i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[n-2],y:+t[n-1]}:n-4==i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}function o(t,e,r,i,n){var a=-3*e+9*r-9*i+3*n,s=t*a+6*e-12*r+6*i;return t*s-3*e+3*r}function l(t,e,r,i,n,a,s,l,h){null==h&&(h=1),h=h>1?1:h<0?0:h;for(var u=h/2,c=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<c;g++){var v=u*f[g]+u,x=o(v,t,r,n,s),y=o(v,e,i,a,l),m=x*x+y*y;d+=p[g]*Y.sqrt(m)}return u*d}function h(t,e,r,i,n,a,s,o,h){if(!(h<0||l(t,e,r,i,n,a,s,o)<h)){var u=1,c=u/2,f=u-c,p,d=.01;for(p=l(t,e,r,i,n,a,s,o,f);H(p-h)>d;)c/=2,f+=(p<h?1:-1)*c,p=l(t,e,r,i,n,a,s,o,f);return f}}function u(t,e,r,i,n,a,s,o){if(!(W(t,r)<G(n,s)||G(t,r)>W(n,s)||W(e,i)<G(a,o)||G(e,i)>W(a,o))){var l=(t*i-e*r)*(n-s)-(t-r)*(n*o-a*s),h=(t*i-e*r)*(a-o)-(e-i)*(n*o-a*s),u=(t-r)*(a-o)-(e-i)*(n-s);if(u){var c=l/u,f=h/u,p=+c.toFixed(2),d=+f.toFixed(2);if(!(p<+G(t,r).toFixed(2)||p>+W(t,r).toFixed(2)||p<+G(n,s).toFixed(2)||p>+W(n,s).toFixed(2)||d<+G(e,i).toFixed(2)||d>+W(e,i).toFixed(2)||d<+G(a,o).toFixed(2)||d>+W(a,o).toFixed(2)))return{x:c,y:f}}}}function c(t,e){return p(t,e)}function f(t,e){return p(t,e,1)}function p(t,r,i){var n=e.bezierBBox(t),a=e.bezierBBox(r);if(!e.isBBoxIntersect(n,a))return i?0:[];for(var s=l.apply(0,t),o=l.apply(0,r),h=W(~~(s/5),1),c=W(~~(o/5),1),f=[],p=[],d={},g=i?0:[],v=0;v<h+1;v++){var x=e.findDotsAtSegment.apply(e,t.concat(v/h));f.push({x:x.x,y:x.y,t:v/h})}for(v=0;v<c+1;v++)x=e.findDotsAtSegment.apply(e,r.concat(v/c)),p.push({x:x.x,y:x.y,t:v/c});for(v=0;v<h;v++)for(var y=0;y<c;y++){var m=f[v],b=f[v+1],_=p[y],w=p[y+1],k=H(b.x-m.x)<.001?"y":"x",B=H(w.x-_.x)<.001?"y":"x",C=u(m.x,m.y,b.x,b.y,_.x,_.y,w.x,w.y);if(C){if(d[C.x.toFixed(4)]==C.y.toFixed(4))continue;d[C.x.toFixed(4)]=C.y.toFixed(4);var S=m.t+H((C[k]-m[k])/(b[k]-m[k]))*(b.t-m.t),A=_.t+H((C[B]-_[B])/(w[B]-_[B]))*(w.t-_.t);S>=0&&S<=1.001&&A>=0&&A<=1.001&&(i?g++:g.push({x:C.x,y:C.y,t1:G(S,1),t2:G(A,1)}))}}return g}function d(t,r,i){t=e._path2curve(t),r=e._path2curve(r);for(var n,a,s,o,l,h,u,c,f,d,g=i?0:[],v=0,x=t.length;v<x;v++){var y=t[v];if("M"==y[0])n=l=y[1],a=h=y[2];else{"C"==y[0]?(f=[n,a].concat(y.slice(1)),n=f[6],a=f[7]):(f=[n,a,n,a,l,h,l,h],n=l,a=h);for(var m=0,b=r.length;m<b;m++){var _=r[m];if("M"==_[0])s=u=_[1],o=c=_[2];else{"C"==_[0]?(d=[s,o].concat(_.slice(1)),s=d[6],o=d[7]):(d=[s,o,s,o,u,c,u,c],s=u,o=c);var w=p(f,d,i);if(i)g+=w;else{for(var k=0,B=w.length;k<B;k++)w[k].segment1=v,w[k].segment2=m,w[k].bez1=f,w[k].bez2=d;g=g.concat(w)}}}}}return g}function g(t,e,r,i,n,a){null!=t?(this.a=+t,this.b=+e,this.c=+r,this.d=+i,this.e=+n,this.f=+a):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function v(){return this.x+j+this.y}function x(){return this.x+j+this.y+j+this.width+" × "+this.height}function y(t,e,r,i,n,a){function s(t){return((c*t+u)*t+h)*t}function o(t,e){var r=l(t,e);return((d*r+p)*r+f)*r}function l(t,e){var r,i,n,a,o,l;for(n=t,l=0;l<8;l++){if(a=s(n)-t,H(a)<e)return n;if(o=(3*c*n+2*u)*n+h,H(o)<1e-6)break;n-=a/o}if(r=0,i=1,n=t,n<r)return r;if(n>i)return i;for(;r<i;){if(a=s(n),H(a-t)<e)return n;t>a?r=nLine truncated
|
||||
this.add(1,0,0,1,t,e)},t.scale=function(t,e,r,i){null==e&&(e=t),(r||i)&&this.add(1,0,0,1,r,i),this.add(t,0,0,e,0,0),(r||i)&&this.add(1,0,0,1,-r,-i)},t.rotate=function(t,r,i){t=e.rad(t),r=r||0,i=i||0;var n=+Y.cos(t).toFixed(9),a=+Y.sin(t).toFixed(9);this.add(n,a,-a,n,r,i),this.add(1,0,0,1,-r,-i)},t.x=function(t,e){return t*this.a+e*this.c+this.e},t.y=function(t,e){return t*this.b+e*this.d+this.f},t.get=function(t){return+this[I.fromCharCode(97+t)].toFixed(4)},t.toString=function(){return e.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},t.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},t.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},t.split=function(){var t={};t.dx=this.e,t.dy=this.f;var n=[[this.a,this.c],[this.b,this.d]];t.scalex=Y.sqrt(r(n[0])),i(n[0]),t.shear=n[0][0]*n[1][0]+n[0][1]*n[1][1],n[1]=[n[1][0]-n[0][0]*t.shear,n[1][1]-n[0][1]*t.shear],t.scaley=Y.sqrt(r(n[1])),i(n[1]),t.shear/=t.scaley;var a=-n[0][1],s=n[1][1];return s<0?(t.rotate=e.deg(Y.acos(s)),a<0&&(t.rotate=360-t.rotate)):t.rotate=e.deg(Y.asin(a)),t.isSimple=!(+t.shear.toFixed(9)||t.scalex.toFixed(9)!=t.scaley.toFixed(9)&&t.rotate),t.isSuperSimple=!+t.shear.toFixed(9)&&t.scalex.toFixed(9)==t.scaley.toFixed(9)&&!t.rotate,t.noRotation=!+t.shear.toFixed(9)&&!t.rotate,t},t.toTransformString=function(t){var e=t||this[q]();return e.isSimple?(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[e.dx,e.dy]:R)+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:R)+(e.rotate?"r"+[e.rotate,0,0]:R)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(g.prototype);for(var he=function(){this.returnValue=!1},ue=function(){return this.originalEvent.preventDefault()},ce=function(){this.cancelBubble=!0},fe=function(){return this.originalEvent.stopPropagation()},pe=function(t){var e=T.doc.documentElement.scrollTop||T.doc.body.scrollTop,r=T.doc.documentElement.scrollLeft||T.doc.body.scrollLeft;return{x:t.clientX+r,y:t.clientY+e}},de=function(){return T.doc.addEventListener?function(t,e,r,i){var n=function(t){var e=pe(t);return r.call(i,t,e.x,e.y)};if(t.addEventListener(e,n,!1),F&&V[e]){var a=function(e){for(var n=pe(e),a=e,s=0,o=e.targetTouches&&e.targetTouches.length;s<o;s++)if(e.targetTouches[s].target==t){e=e.targetTouches[s],e.originalEvent=a,e.preventDefault=ue,e.stopPropagation=fe;break}return r.call(i,e,n.x,n.y)};t.addEventListener(V[e],a,!1)}return function(){return t.removeEventListener(e,n,!1),F&&V[e]&&t.removeEventListener(V[e],a,!1),!0}}:T.doc.attachEvent?function(t,e,r,i){var n=function(t){t=t||T.win.event;var e=T.doc.documentElement.scrollTop||T.doc.body.scrollTop,n=T.doc.documentElement.scrollLeft||T.doc.body.scrollLeft,a=t.clientX+n,s=t.clientY+e;return t.preventDefault=t.preventDefault||he,t.stopPropagation=t.stopPropagation||ce,r.call(i,t,a,s)};t.attachEvent("on"+e,n);var a=function(){return t.detachEvent("on"+e,n),!0};return a}:void 0}(),ge=[],ve=function(e){for(var r=e.clientX,i=e.clientY,n=T.doc.documentElement.scrollTop||T.doc.body.scrollTop,a=T.doc.documentElement.scrollLeft||T.doc.body.scrollLeft,s,o=ge.length;o--;){if(s=ge[o],F&&e.touches){for(var l=e.touches.length,h;l--;)if(h=e.touches[l],h.identifier==s.el._drag.id){r=h.clientX,i=h.clientY,(e.originalEvent?e.originalEvent:e).preventDefault();break}}else e.preventDefault();var u=s.el.node,c,f=u.nextSibling,p=u.parentNode,d=u.style.display;T.win.opera&&p.removeChild(u),u.style.display="none",c=s.el.paper.getElementByPoint(r,i),u.style.display=d,T.win.opera&&(f?p.insertBefore(u,f):p.appendChild(u)),c&&t("raphael.drag.over."+s.el.id,s.el,c),r+=a,i+=n,t("raphael.drag.move."+s.el.id,s.move_scope||s.el,r-s.el._drag.x,i-s.el._drag.y,r,i,e)}},xe=function(r){e.unmousemove(ve).unmouseup(xe);for(var i=ge.length,n;i--;)n=ge[i],n.el._drag={},t("raphael.drag.end."+n.el.id,n.end_scope||n.start_scope||n.move_scope||n.el,r);ge=[]},ye=e.el={},me=D.length;me--;)!function(t){e[t]=ye[t]=function(r,i){return e.is(r,"function")&&(this.events=this.events||[],this.events.push({name:t,f:r,unbind:de(this.shape||this.node||T.doc,t,r,i||this)})),this},e["un"+t]=ye["un"+t]=function(r){for(var i=this.events||[],n=i.length;n--;)i[n].name!=t||!e.is(r,"undefined")&&i[n].f!=r||(i[n].unbind(),i.splice(n,1),!i.length&&delete this.events);return this}}(D[me]);ye.data=function(r,i){var n=wt[this.id]=wt[this.id]||{};if(0==arguments.length)return n;if(1==arguments.length){if(e.is(r,"object")){for(var a in r)r[A](a)&&this.data(a,r[a]);return this}return t("raphael.data.get."+this.id,this,n[r],r),n[r]}return n[r]=i,t("raphael.data.set."+this.id,this,i,r),this},ye.removeData=function(t){return null==t?wt[this.id]={}:wt[this.id]&&delete wt[this.iLine truncated
|
||||
i._.arrows&&("startString"in i._.arrows&&_(i,i._.arrows.startString),"endString"in i._.arrows&&_(i,i._.arrows.endString,1));break;case"stroke-dasharray":k(i,g,a);break;case"fill":var N=r(g).match(t._ISURL);if(N){A=v("pattern");var L=v("image");A.id=t.createUUID(),v(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),v(L,{x:0,y:0,"xlink:href":N[1]}),A.appendChild(L),function(e){t._preload(N[1],function(){var t=this.offsetWidth,r=this.offsetHeight;v(e,{width:t,height:r}),v(L,{width:t,height:r})})}(A),i.paper.defs.appendChild(A),v(l,{fill:"url(#"+A.id+")"}),i.pattern=A,i.pattern&&b(i);break}var z=t.getRGB(g);if(z.error){if(("circle"==i.type||"ellipse"==i.type||"r"!=r(g).charAt())&&x(i,g)){if("opacity"in u||"fill-opacity"in u){var P=t._g.doc.getElementById(l.getAttribute("fill").replace(/^url\(#|\)$/g,c));if(P){var F=P.getElementsByTagName("stop");v(F[F.length-1],{"stop-opacity":("opacity"in u?u.opacity:1)*("fill-opacity"in u?u["fill-opacity"]:1)})}}u.gradient=g,u.fill="none";break}}else delete a.gradient,delete u.gradient,!t.is(u.opacity,"undefined")&&t.is(a.opacity,"undefined")&&v(l,{opacity:u.opacity}),!t.is(u["fill-opacity"],"undefined")&&t.is(a["fill-opacity"],"undefined")&&v(l,{"fill-opacity":u["fill-opacity"]});z[e]("opacity")&&v(l,{"fill-opacity":z.opacity>1?z.opacity/100:z.opacity});case"stroke":z=t.getRGB(g),l.setAttribute(d,z.hex),"stroke"==d&&z[e]("opacity")&&v(l,{"stroke-opacity":z.opacity>1?z.opacity/100:z.opacity}),"stroke"==d&&i._.arrows&&("startString"in i._.arrows&&_(i,i._.arrows.startString),"endString"in i._.arrows&&_(i,i._.arrows.endString,1));break;case"gradient":("circle"==i.type||"ellipse"==i.type||"r"!=r(g).charAt())&&x(i,g);break;case"opacity":u.gradient&&!u[e]("stroke-opacity")&&v(l,{"stroke-opacity":g>1?g/100:g});case"fill-opacity":if(u.gradient){P=t._g.doc.getElementById(l.getAttribute("fill").replace(/^url\(#|\)$/g,c)),P&&(F=P.getElementsByTagName("stop"),v(F[F.length-1],{"stop-opacity":g}));break}default:"font-size"==d&&(g=n(g,10)+"px");var R=d.replace(/(\-.)/g,function(t){return t.substring(1).toUpperCase()});l.style[R]=g,i._.dirty=1,l.setAttribute(d,g)}}S(i,a),l.style.visibility=f},C=1.2,S=function(i,a){if("text"==i.type&&(a[e]("text")||a[e]("font")||a[e]("font-size")||a[e]("x")||a[e]("y"))){var s=i.attrs,o=i.node,l=o.firstChild?n(t._g.doc.defaultView.getComputedStyle(o.firstChild,c).getPropertyValue("font-size"),10):10;if(a[e]("text")){for(s.text=a.text;o.firstChild;)o.removeChild(o.firstChild);for(var h=r(a.text).split("\n"),u=[],f,p=0,d=h.length;p<d;p++)f=v("tspan"),p&&v(f,{dy:l*C,x:s.x}),f.appendChild(t._g.doc.createTextNode(h[p])),o.appendChild(f),u[p]=f}else for(u=o.getElementsByTagName("tspan"),p=0,d=u.length;p<d;p++)p?v(u[p],{dy:l*C,x:s.x}):v(u[0],{dy:0});v(o,{x:s.x,y:s.y}),i._.dirty=1;var g=i._getBBox(),x=s.y-(g.y+g.height/2);x&&t.is(x,"finite")&&v(u[0],{dy:x})}},A=function(t){return t.parentNode&&"a"===t.parentNode.tagName.toLowerCase()?t.parentNode:t},T=function(e,r){function i(){return("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5)}var n=0,a=0;this[0]=this.node=e,e.raphael=!0,this.id=i(),e.raphaelid=this.id,this.matrix=t.matrix(),this.realPath=null,this.paper=r,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},E=t.el;T.prototype=E,E.constructor=T,t._engine.path=function(t,e){var r=v("path");e.canvas&&e.canvas.appendChild(r);var i=new T(r,e);return i.type="path",B(i,{fill:"none",stroke:"#000",path:t}),i},E.rotate=function(t,e,n){if(this.removed)return this;if(t=r(t).split(h),t.length-1&&(e=i(t[1]),n=i(t[2])),t=i(t[0]),null==n&&(e=n),null==e||null==n){var a=this.getBBox(1);e=a.x+a.width/2,n=a.y+a.height/2}return this.transform(this._.transform.concat([["r",t,e,n]])),this},E.scale=function(t,e,n,a){if(this.removed)return this;if(t=r(t).split(h),t.length-1&&(e=i(t[1]),n=i(t[2]),a=i(t[3])),t=i(t[0]),null==e&&(e=t),null==a&&(n=a),null==n||null==a)var s=this.getBBox(1);return n=null==n?s.x+s.width/2:n,a=null==a?s.y+s.height/2:a,this.transform(this._.transform.concat([["s",t,e,n,a]])),this},E.translate=function(t,e){return this.removed?this:(t=r(t).split(h),t.length-1&&(e=i(t[1])),t=i(t[0])||0,e=+e||0,this.transform(this._.transform.concat([["t",t,e]])),this)},E.transform=function(r){var i=this._;if(null==r)return i.transform;if(t._extractTransform(this,r),this.clip&&v(this.clip,{transform:this.matrix.invert()}),this.pattern&&b(this),this.node&&v(this.node,{transform:this.matrix}),1!=i.sx||1!=i.sy){var n=this.attrs[e]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":n})}return this},E.hide=function(){return this.removed||(this.node.style.display="none"),this},E.show=function(){return this.removed||(this.node.style.display=""),this},E.remove=function(){var e=A(this.node);if(!this.removed&&e.parentNode){var r=this.paper;r.__set__&&r.__set__.exclude(this),u.unbind("raphael.*.*."+this.id),this.gradient&&r.Line truncated
|
||||
+7927
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,3 @@
|
||||
!function t(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("eve")):"function"==typeof define&&define.amd?define(["eve"],r):"object"==typeof exports?exports.Raphael=r(require("eve")):e.Raphael=r(e.eve)}(this,function(t){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var i,n;i=[r(1),r(3),r(4)],n=function(t){return t}.apply(e,i),!(void 0!==n&&(t.exports=n))},function(t,e,r){var i,n;i=[r(2)],n=function(t){function e(r){if(e.is(r,"function"))return w?r():t.on("raphael.DOMload",r);if(e.is(r,Q))return e._engine.create[F](e,r.splice(0,3+e.is(r[0],$))).add(r);var i=Array.prototype.slice.call(arguments,0);if(e.is(i[i.length-1],"function")){var n=i.pop();return w?n.call(e._engine.create[F](e,i)):t.on("raphael.DOMload",function(){n.call(e._engine.create[F](e,i))})}return e._engine.create[F](e,arguments)}function r(t){if("function"==typeof t||Object(t)!==t)return t;var e=new t.constructor;for(var i in t)t[T](i)&&(e[i]=r(t[i]));return e}function i(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return t.push(t.splice(r,1)[0])}function n(t,e,r){function n(){var a=Array.prototype.slice.call(arguments,0),s=a.join("␀"),o=n.cache=n.cache||{},l=n.count=n.count||[];return o[T](s)?(i(l,s),r?r(o[s]):o[s]):(l.length>=1e3&&delete o[l.shift()],l.push(s),o[s]=t[F](e,a),r?r(o[s]):o[s])}return n}function a(){return this.hex}function s(t,e){for(var r=[],i=0,n=t.length;n-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?n-4==i?a[3]={x:+t[0],y:+t[1]}:n-2==i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[n-2],y:+t[n-1]}:n-4==i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}function o(t,e,r,i,n){var a=-3*e+9*r-9*i+3*n,s=t*a+6*e-12*r+6*i;return t*s-3*e+3*r}function l(t,e,r,i,n,a,s,l,h){null==h&&(h=1),h=h>1?1:h<0?0:h;for(var u=h/2,c=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<c;g++){var x=u*f[g]+u,v=o(x,t,r,n,s),y=o(x,e,i,a,l),m=v*v+y*y;d+=p[g]*W.sqrt(m)}return u*d}function h(t,e,r,i,n,a,s,o,h){if(!(h<0||l(t,e,r,i,n,a,s,o)<h)){var u=1,c=u/2,f=u-c,p,d=.01;for(p=l(t,e,r,i,n,a,s,o,f);H(p-h)>d;)c/=2,f+=(p<h?1:-1)*c,p=l(t,e,r,i,n,a,s,o,f);return f}}function u(t,e,r,i,n,a,s,o){if(!(Y(t,r)<G(n,s)||G(t,r)>Y(n,s)||Y(e,i)<G(a,o)||G(e,i)>Y(a,o))){var l=(t*i-e*r)*(n-s)-(t-r)*(n*o-a*s),h=(t*i-e*r)*(a-o)-(e-i)*(n*o-a*s),u=(t-r)*(a-o)-(e-i)*(n-s);if(u){var c=l/u,f=h/u,p=+c.toFixed(2),d=+f.toFixed(2);if(!(p<+G(t,r).toFixed(2)||p>+Y(t,r).toFixed(2)||p<+G(n,s).toFixed(2)||p>+Y(n,s).toFixed(2)||d<+G(e,i).toFixed(2)||d>+Y(e,i).toFixed(2)||d<+G(a,o).toFixed(2)||d>+Y(a,o).toFixed(2)))return{x:c,y:f}}}}function c(t,e){return p(t,e)}function f(t,e){return p(t,e,1)}function p(t,r,i){var n=e.bezierBBox(t),a=e.bezierBBox(r);if(!e.isBBoxIntersect(n,a))return i?0:[];for(var s=l.apply(0,t),o=l.apply(0,r),h=Y(~~(s/5),1),c=Y(~~(o/5),1),f=[],p=[],d={},g=i?0:[],x=0;x<h+1;x++){var v=e.findDotsAtSegment.apply(e,t.concat(x/h));f.push({x:v.x,y:v.y,t:x/h})}for(x=0;x<c+1;x++)v=e.findDotsAtSegment.apply(e,r.concat(x/c)),p.push({x:v.x,y:v.y,t:x/c});for(x=0;x<h;x++)for(var y=0;y<c;y++){var m=f[x],b=f[x+1],_=p[y],w=p[y+1],k=H(b.x-m.x)<.001?"y":"x",B=H(w.x-_.x)<.001?"y":"x",C=u(m.x,m.y,b.x,b.y,_.x,_.y,w.x,w.y);if(C){if(d[C.x.toFixed(4)]==C.y.toFixed(4))continue;d[C.x.toFixed(4)]=C.y.toFixed(4);var S=m.t+H((C[k]-m[k])/(b[k]-m[k]))*(b.t-m.t),T=_.t+H((C[B]-_[B])/(w[B]-_[B]))*(w.t-_.t);S>=0&&S<=1.001&&T>=0&&T<=1.001&&(i?g++:g.push({x:C.x,y:C.y,t1:G(S,1),t2:G(T,1)}))}}return g}function d(t,r,i){t=e._path2curve(t),r=e._path2curve(r);for(var n,a,s,o,l,h,u,c,f,d,g=i?0:[],x=0,v=t.length;x<v;x++){var y=t[x];if("M"==y[0])n=l=y[1],a=h=y[2];else{"C"==y[0]?(f=[n,a].concat(y.slice(1)),n=f[6],a=f[7]):(f=[n,a,n,a,l,h,l,h],n=l,a=h);for(var m=0,b=r.length;m<b;m++){var _=r[m];if("M"==_[0])s=u=_[1],o=c=_[2];else{"C"==_[0]?(d=[s,o].concat(_.slice(1)),s=d[6],o=d[7]):(d=[s,o,s,o,u,c,u,c],s=u,o=c);var w=p(f,d,i);if(i)g+=w;else{for(var k=0,B=w.length;k<B;k++)w[k].segment1=x,w[k].segment2=m,w[k].bez1=f,w[k].bez2=d;g=g.concat(w)}}}}}return g}function g(t,e,r,i,n,a){null!=t?(this.a=+t,this.b=+e,this.c=+r,this.d=+i,this.e=+n,this.f=+a):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function x(){return this.x+j+this.y}function v(){return this.x+j+this.y+j+this.width+" × "+this.height}function y(t,e,r,i,n,a){function s(t){return((c*t+u)*t+h)*t}function o(t,e){var r=l(t,e);return((d*r+p)*r+f)*r}function l(t,e){var r,i,n,a,o,l;for(n=t,l=0;l<8;l++){if(a=s(n)-t,H(a)<e)return n;if(o=(3*c*n+2*u)*n+h,H(o)<1e-6)break;n-=a/o}if(r=0,i=1,n=t,n<r)return r;if(n>i)return i;for(;r<Line truncated
|
||||
},t.translate=function(t,e){this.add(1,0,0,1,t,e)},t.scale=function(t,e,r,i){null==e&&(e=t),(r||i)&&this.add(1,0,0,1,r,i),this.add(t,0,0,e,0,0),(r||i)&&this.add(1,0,0,1,-r,-i)},t.rotate=function(t,r,i){t=e.rad(t),r=r||0,i=i||0;var n=+W.cos(t).toFixed(9),a=+W.sin(t).toFixed(9);this.add(n,a,-a,n,r,i),this.add(1,0,0,1,-r,-i)},t.x=function(t,e){return t*this.a+e*this.c+this.e},t.y=function(t,e){return t*this.b+e*this.d+this.f},t.get=function(t){return+this[q.fromCharCode(97+t)].toFixed(4)},t.toString=function(){return e.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},t.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},t.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},t.split=function(){var t={};t.dx=this.e,t.dy=this.f;var n=[[this.a,this.c],[this.b,this.d]];t.scalex=W.sqrt(r(n[0])),i(n[0]),t.shear=n[0][0]*n[1][0]+n[0][1]*n[1][1],n[1]=[n[1][0]-n[0][0]*t.shear,n[1][1]-n[0][1]*t.shear],t.scaley=W.sqrt(r(n[1])),i(n[1]),t.shear/=t.scaley;var a=-n[0][1],s=n[1][1];return s<0?(t.rotate=e.deg(W.acos(s)),a<0&&(t.rotate=360-t.rotate)):t.rotate=e.deg(W.asin(a)),t.isSimple=!(+t.shear.toFixed(9)||t.scalex.toFixed(9)!=t.scaley.toFixed(9)&&t.rotate),t.isSuperSimple=!+t.shear.toFixed(9)&&t.scalex.toFixed(9)==t.scaley.toFixed(9)&&!t.rotate,t.noRotation=!+t.shear.toFixed(9)&&!t.rotate,t},t.toTransformString=function(t){var e=t||this[I]();return e.isSimple?(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[e.dx,e.dy]:R)+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:R)+(e.rotate?"r"+[e.rotate,0,0]:R)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(g.prototype);for(var he=function(){this.returnValue=!1},ue=function(){return this.originalEvent.preventDefault()},ce=function(){this.cancelBubble=!0},fe=function(){return this.originalEvent.stopPropagation()},pe=function(t){var e=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,r=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;return{x:t.clientX+r,y:t.clientY+e}},de=function(){return A.doc.addEventListener?function(t,e,r,i){var n=function(t){var e=pe(t);return r.call(i,t,e.x,e.y)};if(t.addEventListener(e,n,!1),z&&V[e]){var a=function(e){for(var n=pe(e),a=e,s=0,o=e.targetTouches&&e.targetTouches.length;s<o;s++)if(e.targetTouches[s].target==t){e=e.targetTouches[s],e.originalEvent=a,e.preventDefault=ue,e.stopPropagation=fe;break}return r.call(i,e,n.x,n.y)};t.addEventListener(V[e],a,!1)}return function(){return t.removeEventListener(e,n,!1),z&&V[e]&&t.removeEventListener(V[e],a,!1),!0}}:A.doc.attachEvent?function(t,e,r,i){var n=function(t){t=t||A.win.event;var e=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,n=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,a=t.clientX+n,s=t.clientY+e;return t.preventDefault=t.preventDefault||he,t.stopPropagation=t.stopPropagation||ce,r.call(i,t,a,s)};t.attachEvent("on"+e,n);var a=function(){return t.detachEvent("on"+e,n),!0};return a}:void 0}(),ge=[],xe=function(e){for(var r=e.clientX,i=e.clientY,n=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,a=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,s,o=ge.length;o--;){if(s=ge[o],z&&e.touches){for(var l=e.touches.length,h;l--;)if(h=e.touches[l],h.identifier==s.el._drag.id){r=h.clientX,i=h.clientY,(e.originalEvent?e.originalEvent:e).preventDefault();break}}else e.preventDefault();var u=s.el.node,c,f=u.nextSibling,p=u.parentNode,d=u.style.display;A.win.opera&&p.removeChild(u),u.style.display="none",c=s.el.paper.getElementByPoint(r,i),u.style.display=d,A.win.opera&&(f?p.insertBefore(u,f):p.appendChild(u)),c&&t("raphael.drag.over."+s.el.id,s.el,c),r+=a,i+=n,t("raphael.drag.move."+s.el.id,s.move_scope||s.el,r-s.el._drag.x,i-s.el._drag.y,r,i,e)}},ve=function(r){e.unmousemove(xe).unmouseup(ve);for(var i=ge.length,n;i--;)n=ge[i],n.el._drag={},t("raphael.drag.end."+n.el.id,n.end_scope||n.start_scope||n.move_scope||n.el,r);ge=[]},ye=e.el={},me=D.length;me--;)!function(t){e[t]=ye[t]=function(r,i){return e.is(r,"function")&&(this.events=this.events||[],this.events.push({name:t,f:r,unbind:de(this.shape||this.node||A.doc,t,r,i||this)})),this},e["un"+t]=ye["un"+t]=function(r){for(var i=this.events||[],n=i.length;n--;)i[n].name!=t||!e.is(r,"undefined")&&i[n].f!=r||(i[n].unbind(),i.splice(n,1),!i.length&&delete this.events);return this}}(D[me]);ye.data=function(r,i){var n=wt[this.id]=wt[this.id]||{};if(0==arguments.length)return n;if(1==arguments.length){if(e.is(r,"object")){for(var a in r)r[T](a)&&this.data(a,r[a]);return this}return t("raphael.data.get."+this.id,this,n[r],r),n[r]}return n[r]=i,t("raphael.data.set."+this.id,this,i,r),this},ye.removeData=function(t){return null==t?wt[this.id]={}:wLine truncated
|
||||
e.raphael=!0,this.id=i(),e.raphaelid=this.id,this.matrix=t.matrix(),this.realPath=null,this.paper=r,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},M=t.el;A.prototype=M,M.constructor=A,t._engine.path=function(t,e){var r=x("path");e.canvas&&e.canvas.appendChild(r);var i=new A(r,e);return i.type="path",B(i,{fill:"none",stroke:"#000",path:t}),i},M.rotate=function(t,e,n){if(this.removed)return this;if(t=r(t).split(h),t.length-1&&(e=i(t[1]),n=i(t[2])),t=i(t[0]),null==n&&(e=n),null==e||null==n){var a=this.getBBox(1);e=a.x+a.width/2,n=a.y+a.height/2}return this.transform(this._.transform.concat([["r",t,e,n]])),this},M.scale=function(t,e,n,a){if(this.removed)return this;if(t=r(t).split(h),t.length-1&&(e=i(t[1]),n=i(t[2]),a=i(t[3])),t=i(t[0]),null==e&&(e=t),null==a&&(n=a),null==n||null==a)var s=this.getBBox(1);return n=null==n?s.x+s.width/2:n,a=null==a?s.y+s.height/2:a,this.transform(this._.transform.concat([["s",t,e,n,a]])),this},M.translate=function(t,e){return this.removed?this:(t=r(t).split(h),t.length-1&&(e=i(t[1])),t=i(t[0])||0,e=+e||0,this.transform(this._.transform.concat([["t",t,e]])),this)},M.transform=function(r){var i=this._;if(null==r)return i.transform;if(t._extractTransform(this,r),this.clip&&x(this.clip,{transform:this.matrix.invert()}),this.pattern&&b(this),this.node&&x(this.node,{transform:this.matrix}),1!=i.sx||1!=i.sy){var n=this.attrs[e]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":n})}return this},M.hide=function(){return this.removed||(this.node.style.display="none"),this},M.show=function(){return this.removed||(this.node.style.display=""),this},M.remove=function(){var e=T(this.node);if(!this.removed&&e.parentNode){var r=this.paper;r.__set__&&r.__set__.exclude(this),u.unbind("raphael.*.*."+this.id),this.gradient&&r.defs.removeChild(this.gradient),t._tear(this,r),e.parentNode.removeChild(e),this.removeData();for(var i in this)this[i]="function"==typeof this[i]?t._removedFactory(i):null;this.removed=!0}},M._getBBox=function(){if("none"==this.node.style.display){this.show();var t=!0}var e=!1,r;this.paper.canvas.parentElement?r=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(r=this.paper.canvas.parentNode.style),r&&"none"==r.display&&(e=!0,r.display="");var i={};try{i=this.node.getBBox()}catch(n){i={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{i=i||{},e&&(r.display="none")}return t&&this.hide(),i},M.attr=function(r,i){if(this.removed)return this;if(null==r){var n={};for(var a in this.attrs)this.attrs[e](a)&&(n[a]=this.attrs[a]);return n.gradient&&"none"==n.fill&&(n.fill=n.gradient)&&delete n.gradient,n.transform=this._.transform,n}if(null==i&&t.is(r,"string")){if("fill"==r&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==r)return this._.transform;for(var s=r.split(h),o={},l=0,c=s.length;l<c;l++)r=s[l],r in this.attrs?o[r]=this.attrs[r]:t.is(this.paper.customAttributes[r],"function")?o[r]=this.paper.customAttributes[r].def:o[r]=t._availableAttrs[r];return c-1?o:o[s[0]]}if(null==i&&t.is(r,"array")){for(o={},l=0,c=r.length;l<c;l++)o[r[l]]=this.attr(r[l]);return o}if(null!=i){var f={};f[r]=i}else null!=r&&t.is(r,"object")&&(f=r);for(var p in f)u("raphael.attr."+p+"."+this.id,this,f[p]);for(p in this.paper.customAttributes)if(this.paper.customAttributes[e](p)&&f[e](p)&&t.is(this.paper.customAttributes[p],"function")){var d=this.paper.customAttributes[p].apply(this,[].concat(f[p]));this.attrs[p]=f[p];for(var g in d)d[e](g)&&(f[g]=d[g])}return B(this,f),this},M.toFront=function(){if(this.removed)return this;var e=T(this.node);e.parentNode.appendChild(e);var r=this.paper;return r.top!=this&&t._tofront(this,r),this},M.toBack=function(){if(this.removed)return this;var e=T(this.node),r=e.parentNode;r.insertBefore(e,r.firstChild),t._toback(this,this.paper);var i=this.paper;return this},M.insertAfter=function(e){if(this.removed||!e)return this;var r=T(this.node),i=T(e.node||e[e.length-1].node);return i.nextSibling?i.parentNode.insertBefore(r,i.nextSibling):i.parentNode.appendChild(r),t._insertafter(this,e,this.paper),this},M.insertBefore=function(e){if(this.removed||!e)return this;var r=T(this.node),i=T(e.node||e[0].node);return i.parentNode.insertBefore(r,i),t._insertbefore(this,e,this.paper),this},M.blur=function(e){var r=this;if(0!==+e){var i=x("filter"),n=x("feGaussianBlur");r.attrs.blur=e,i.id=t.createUUID(),x(n,{stdDeviation:+e||1.5}),i.appendChild(n),r.paper.defs.appendChild(i),r._blur=i,x(r.node,{filter:"url(#"+i.id+")"})}else r._blur&&(r._blur.parentNode.removeChild(r._blur),delete r._blur,delete r.attrs.blur),r.node.removeAttribute("filter");return r},t._engine.circle=function(t,e,r,i){var n=x("circle");t.canvas&&t.canvas.appendChild(n);var a=new A(n,t);return a.attrs={cx:e,cy:r,r:i,fill:"none",stroke:"#000"},a.type="circLine truncated
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
|
||||
const webpack = require("webpack");
|
||||
const fs = require("fs");
|
||||
|
||||
const args = process.argv;
|
||||
|
||||
let plugins = [
|
||||
new webpack.BannerPlugin(fs.readFileSync('./dev/banner.txt', 'utf8'), { raw: true, entryOnly: true })
|
||||
];
|
||||
let externals = [];
|
||||
let filename = "raphael";
|
||||
|
||||
|
||||
if(args.indexOf('--no-deps') !== -1){
|
||||
console.log('Building version without deps');
|
||||
externals.push("eve");
|
||||
filename += ".no-deps"
|
||||
}
|
||||
|
||||
if(args.indexOf('--min') !== -1){
|
||||
console.log('Building minified version');
|
||||
plugins.push(
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress:{
|
||||
dead_code: false,
|
||||
unused: false
|
||||
}
|
||||
})
|
||||
);
|
||||
filename += ".min"
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: './dev/raphael.amd.js',
|
||||
output: {
|
||||
filename: filename + ".js",
|
||||
libraryTarget: "umd",
|
||||
library: "Raphael"
|
||||
},
|
||||
|
||||
externals: externals,
|
||||
|
||||
plugins: plugins,
|
||||
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: "eslint-loader",
|
||||
include: "./dev/"
|
||||
}
|
||||
],
|
||||
|
||||
eslint: {
|
||||
configFile: './.eslintrc'
|
||||
},
|
||||
|
||||
resolve: {
|
||||
modulesDirectories: ["bower_components"],
|
||||
alias: {
|
||||
"eve": "eve-raphael/eve"
|
||||
}
|
||||
}
|
||||
};
|
||||
+2012
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user