Updated 3rdparty structure

This commit is contained in:
Pierre
2017-05-26 08:56:32 +02:00
parent 4c80329362
commit 196bbdc585
2311 changed files with 18 additions and 13 deletions

View File

@ -0,0 +1,3 @@
# Raphaël
Cross-browser vector graphics the easy way. Visit the library website for more information: [http://raphaeljs.com](http://raphaeljs.com/)

View File

@ -0,0 +1,398 @@
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#dr-js {
background: #999;
margin: 0;
padding: 0;
overflow-y: hidden;
}
#src-dr-js {
background: #000;
margin: 1em;
padding: 0;
}
.dr-doc {
background: #eee;
border-right: solid #eee 3px;
float: right;
font: 300 16px/1.4 "Myriad Pro", "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif;
height: 100%;
margin: 0;
overflow: auto;
padding: 0 30px;
width: 800px;
}
.dr-toc {
margin: 0;
padding: 0 16px;
background: #ddd;
list-style: none;
font-family: Menlo, Consolas, Monaco, "Lucida Console", monospace;
overflow: auto;
border-right: solid #ddd 3px;
height: 100%;
float: right;
width: 240px;
}
#dr {
margin: 0 auto;
width: 1152px;
height: 100%;
}
::-moz-selection {
background: #c00;
color: #fff;
}
::selection {
background: #c00;
color: #fff;
}
.dr-doc code,
.dr-type em,
.dr-returns em,
.dr-property em {
font-family: Menlo, Consolas, Monaco, "Lucida Console", monospace;
}
pre.code code {
color: #fff;
}
pre.code {
background: #333;
color: #fff;
overflow-x: auto;
padding: 16px 30px;
margin: 0 -30px;
}
code b {
color: #e9df8f;
font-weight: normal;
}
code i,
code i *,
code i .d {
color: #8b9967;
font-style: normal;
}
code .s {
color: #e7be61;
}
code .d {
color: #cf6a4c;
}
code .c,
code .c * {
color: #999;
font-style: italic;
}
em.amp {
font-family: Baskerville, "Goudy Old Style", Palatino, "Book Antiqua", serif;
font-style: italic;
}
dl.dr-parameters {
margin: 8px 0;
}
dt.dr-param {
color: #666;
font-weight: 400;
float: left;
margin-right: 16px;
min-width: 160px;
}
dd.dr-type {
margin: 0;
}
dd.dr-description {
display: table;
min-height: 24px;
border: solid 1px #eee;
}
.dr-type {
float: left;
}
.dr-type em,
.dr-returns em,
.dr-property em {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background: #ccc;
border-radius: 5px;
float: left;
font-size: .75em;
font-style: normal;
font-weight: 700;
margin: 0 8px 0 0;
min-width: 80px;
padding: 2px 5px;
text-align: center;
}
.dr-type em.amp,
.dr-returns em.amp,
.dr-property em.amp {
float: none;
background: none;
font-size: 1em;
font-weight: 400;
font-style: italic;
margin: 0;
padding: 0;
min-width: 0;
}
.dr-property em.dr-type {
margin: 4px 16px 0 0;
}
em.dr-type-string {
background: #e1edb1;
color: #3d4c00;
}
em.dr-type-object {
background: #edb1b1;
color: #4c0000;
}
em.dr-type-function {
background: #cfb1ed;
color: #26004c;
}
em.dr-type-number {
background: #b1c9ed;
color: #001e4c;
}
em.dr-type-boolean {
background: #b1edc9;
color: #004c1e;
}
em.dr-type-array {
background: #edd5b1;
color: #4c2d00;
}
dd.dr-optional {
display: none;
}
ol.dr-json {
background: #ddd;
list-style: none;
margin: 0 -30px;
padding: 16px 30px;
}
ol.dr-json .dr-json-key {
float: left;
min-width: 50px;
margin-right: 16px;
}
ol.dr-json .dr-json-description {
display: table;
}
ol.dr-json ol.dr-json {
margin: 0;
padding: 0 0 0 50px;
}
h1 {
font-weight: 400;
font-size: 2.6em;
margin: 0;
}
h2, h3, h4, h5 {
margin: 1em 0 .5em 0;
padding: 6px 0 0;
font-weight: 600;
position: relative;
}
h5 {
font-size: 18px;
}
h4 {
font-size: 20px;
}
h3 {
font-size: 28px;
}
h2 {
font-size: 38px;
}
h2.dr-method,
h3.dr-method,
h4.dr-method,
h5.dr-method {
color: #900;
}
h2.dr-property,
h3.dr-property,
h4.dr-property,
h5.dr-property {
color: #009;
}
i.dr-trixie {
border: solid 10px #eee;
border-left-color: #999;
height: 0;
margin-left: -30px;
margin-top: -10px;
overflow: hidden;
position: absolute;
top: 50%;
width: 0;
}
p.header {
font-size: 19px;
font-weight: 600;
margin: 1em 0 .3em;
}
.dr-returns {
margin-top: 16px;
}
.dr-returns .dr-title {
float: left;
margin-right: 16px;
width: 160px;
}
.dr-toc a {
display: block;
text-decoration: none;
color: #333;
padding-top: 8px;
position: relative;
z-index: 1000;
}
.dr-toc li.dr-lvl1 a {
padding-left: 1em;
}
.dr-toc li.dr-lvl2 a {
padding-left: 2em;
}
.dr-toc li.dr-lvl3 a {
padding-left: 3em;
}
.dr-toc li.dr-lvl4 a {
padding-left: 4em;
}
.dr-toc li.dr-lvl5 a {
padding-left: 5em;
}
.dr-toc li.dr-lvl6 a {
padding-left: 6em;
}
.dr-toc a.dr-property {
color: #339;
}
.dr-toc a.dr-method {
color: #933;
}
.dr-toc a:hover {
text-shadow: 0 0 2px #333;
}
.dr-toc a.dr-property:hover {
text-shadow: 0 0 2px #66c;
}
.dr-toc a.dr-method:hover {
text-shadow: 0 0 2px #c66;
}
a.dr-hash,
a.dr-sourceline {
-webkit-transition: opacity 0.2s linear;
color: #333;
font-family: Menlo, "Arial Unicode MS", sans-serif;
margin: 0 0 0 .3em;
opacity: 0;
text-decoration: none;
}
a.dr-link {
position: relative;
color: #3875c0;
}
a.dr-link:hover {
text-shadow: 0 1px 2px #999;
bottom: 1px;
padding-bottom: 1px;
}
a.dr-link:visited {
color: #7051bc;
}
h2:hover a.dr-hash,
h3:hover a.dr-hash,
h4:hover a.dr-hash,
h5:hover a.dr-hash,
h2:hover a.dr-sourceline,
h3:hover a.dr-sourceline,
h4:hover a.dr-sourceline,
h5:hover a.dr-sourceline {
opacity: 1;
}
p {
margin: 0 0 .5em;
}
.dr-source-line {
margin: 0;
}
.dr-source-line a {
-webkit-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border-radius: 5px;
color: #000;
background: #999;
font-weight: 400;
font-size: .75em;
text-decoration: none;
padding: 5px;
}
#src-dr-js code {
background: #000;
display: block;
color: #fff;
font-family: Menlo, Consolas, Monaco, "Lucida Console", monospace;
white-space: pre;
padding-left: 100px;
position: relative;
line-height: 1.2;
}
#src-dr-js code:hover {
background: #333;
}
#src-dr-js code:hover .ln {
color: #fff;
}
#src-dr-js code .ln {
position: absolute;
left: 0;
color: #333;
width: 70px;
text-align: right;
}
/*Scrollbar*/
.dr-doc::-webkit-scrollbar,
.dr-toc::-webkit-scrollbar {
width: 7px;
height: 9px;
}
.dr-doc::-webkit-scrollbar-button:start:decrement,
.dr-doc::-webkit-scrollbar-button:end:increment,
.dr-toc::-webkit-scrollbar-button:start:decrement,
.dr-toc::-webkit-scrollbar-button:end:increment {
display: block;
height: 0;
background-color: transparent;
}
.dr-doc::-webkit-scrollbar-track-piece,
.dr-toc::-webkit-scrollbar-track-piece {
-webkit-border-radius: 0;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
}
.dr-doc::-webkit-scrollbar-thumb:vertical,
.dr-toc::-webkit-scrollbar-thumb:vertical {
height: 50px;
background-color: rgba(0, 0, 0, 0.2);
-webkit-border-radius: 4px;
}
.dr-doc::-webkit-scrollbar-thumb:horizontal,
.dr-toc::-webkit-scrollbar-thumb:horizontal {
width: 50px;
background-color: rgba(0, 0, 0, 0.2);
-webkit-border-radius: 4px;
}

View File

@ -0,0 +1,82 @@
2.1.0 • 2012-03-14
------------------
* Put all Eve events into “raphael.” namespace
* Refactored path caching
* Added x2 and y2 to returning bounding box values
* Fixed bug with matrix.f in animation
* Method [Paper.print](http://raphaeljs.com/reference.html#Paper.print) now returns all letters as one path without any transformations applied and supports multiline text
* New methods
* [Element.isPointInside](http://raphaeljs.com/reference.html#Element.isPointInside)
* [Paper.getElementsByPoint](http://raphaeljs.com/reference.html#Paper.getElementsByPoint)
* [Raphael.bezierBBox](http://raphaeljs.com/reference.html#Raphael.bezierBBox)
* [Raphael.isBBoxIntersect](http://raphaeljs.com/reference.html#Raphael.isBBoxIntersect)
* [Raphael.isPointInsideBBox](http://raphaeljs.com/reference.html#Raphael.isPointInsideBBox)
* [Raphael.isPointInsidePath](http://raphaeljs.com/reference.html#Raphael.isPointInsidePath)
* [Raphael.pathBBox](http://raphaeljs.com/reference.html#Raphael.pathBBox)
* [Raphael.pathIntersection](http://raphaeljs.com/reference.html#Raphael.pathIntersection)
* [Raphael.toMatrix](http://raphaeljs.com/reference.html#Raphael.toMatrix)
* [Raphael.transformPath](http://raphaeljs.com/reference.html#Raphael.transformPath)
2.0.2 • 2012-02-08
------------------
* Removing of linked element now removes `<a>` as well
* Fixed white space recognition in passed strings
* Added special case for path that has only one Catmull-Rom curve
* Fixed toTransformString method
* Fixed animateWith method
* Fixed “target” attribute clearing
* Fixed bug with changing fill from image to solid colour
* fixed renderfix method
2.0.1 • 2011-11-18
------------------
* Global variables leakage fix
* `toFront` fix for elements with links
* Gradient clean up
* Added `letter-spacing` attribute
* Fixed hsb methods
* Fixed image flickering
* Improved `toTransformString` method on `matrix`
* Fixed drag'n'drop
* New method [Paper.add](http://raphaeljs.com/reference.html#Paper.add)
* Fix for `clip-path`
* Doc update
2.0.0 • 2011-10-03
------------------
* Completely changed transformation handling:
* `translate()`, `rotate()` and `scale()` are deprecated
* `translation`, `rotation` and `scale` attributes are removed (!)
* new method `transform()` and new attribute `transform` were introduced
* chaining of transformations now allowed
* matrix transformation introduced
* see [docs](http://raphaeljs.com/reference.html#Element.transform)
* Animation API was updated (see [docs](http://raphaeljs.com/reference.html#Raphael.animation))
* delay, repeat, [setTime](http://raphaeljs.com/reference.html#Element.status), [status](http://raphaeljs.com/reference.html#Element.setTime)
* New methods:
* [Paper.setViewBox](http://raphaeljs.com/reference.html#Paper.setViewBox)
* [Paper.setStart](http://raphaeljs.com/reference.html#Paper.setStart)
* [Paper.setFinish](http://raphaeljs.com/reference.html#Paper.setFinish)
* [Paper.forEach](http://raphaeljs.com/reference.html#Paper.forEach)
* [Paper.getById](http://raphaeljs.com/reference.html#Paper.getById)
* [Paper.getElementByPoint](http://raphaeljs.com/reference.html#Paper.getElementByPoint)
* [Element.data](http://raphaeljs.com/reference.html#Element.data)
* [Element.glow](http://raphaeljs.com/reference.html#Element.glow)
* [Element.onDragOver](http://raphaeljs.com/reference.html#Element.onDragOver)
* [Element.removeData](http://raphaeljs.com/reference.html#Element.removeData)
* [Raphael.fullfill](http://raphaeljs.com/reference.html#Raphael.fullfill)
* [Raphael.matrix](http://raphaeljs.com/reference.html#Raphael.matrix)
* [Raphael.parseTransformString](http://raphaeljs.com/reference.html#Raphael.parseTransformString)
* [Set.clear](http://raphaeljs.com/reference.html#Set.clear)
* [Set.exclude](http://raphaeljs.com/reference.html#Set.exclude)
* [Set.forEach](http://raphaeljs.com/reference.html#Set.forEach)
* [Set.splice](http://raphaeljs.com/reference.html#Set.splice)
* VML completely rewritten
* `getBBox` was fixed to take transformations into account
* [eve](http://raphaeljs.com/reference.html#eve) was added to the project
* Whole new [documentation](http://raphaeljs.com/reference.html)
* Various bug fixes

View File

@ -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.

45
assets/3rdparty/adminLTE/plugins/raphael/make vendored Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env node
var setup = {
input: {
core: "raphael.core.js",
svg: "raphael.svg.js",
vml: "raphael.vml.js",
eve: "../mywork/eve/eve.js",
copy: "copy.js"
},
output: {
"raphael-min.js": function () {
return this.copy + "\n" + minify(this.eve + this.core + this.svg + this.vml);
},
"raphael.js": function () {
return this.copy + "\n" + this.eve + "\n\n" + this.core + "\n\n" + this.svg + "\n\n" + this.vml;
},
"raphael.pro-min.js": function () {
return this.copy + "\n" + minify(this.eve + this.core + this.svg);
},
"raphael.pro.js": function () {
return this.copy + "\n" + this.eve + "\n\n" + this.core + "\n\n" + this.svg ;
},
}
},
ujs = require("/Users/dmitry/Sites/UglifyJS/uglify-js.js"),
jsp = ujs.parser,
pro = ujs.uglify,
fs = require("fs"),
rxdr = /\/\*\\[\s\S]+?\\\*\//g;
function minify(code) {
return pro.gen_code(pro.ast_squeeze(pro.ast_mangle(jsp.parse(code))));
}
var files = {};
for (var file in setup.input) {
files[file] = String(fs.readFileSync(setup.input[file], "utf8")).replace(rxdr, "");
}
for (file in setup.output) {
(function (file) {
fs.writeFile(file, setup.output[file].call(files), function () {
console.log("Saved to \033[32m" + file + "\033[0m\n");
});
})(file);
}

View File

@ -0,0 +1,259 @@
/*!
* Color Picker 0.1.0 - Raphael plugin
*
* Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
* Based on Color Wheel (http://jweir.github.com/colorwheel) by John Weir (http://famedriver.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
/*
* Usage
* var cp = Raphael.colorpicker(x, y, size, "#fff"); // #fff is optional init color
* cp.color(); // returns "#fff"
* cp.color("#fc0"); // sets new color
* cp.onchange = function (color) {
* // do something with the color when user change it
* }
* cp.remove(); // removes widget
*/
(function (Raphael) {
Raphael.colorpicker = function (x, y, size, initcolor, element) {
return new ColorPicker(x, y, size, initcolor, element);
};
Raphael.fn.colorPickerIcon = function (x, y, r) {
var segments = pi * r * 2 / Math.min(r / 8, 4);
var a = pi / 2 - pi * 2 / segments * 1.5,
path = ["M", x, y - r, "A", r, r, 0, 0, 1, r * Math.cos(a) + x, y - r * Math.sin(a), "L", x, y, "z"].join();
for (var i = 0; i < segments; i++) {
this.path(path).attr({
stroke: "none",
fill: "hsb(" + (segments - i) * (255 / segments) + ", 255, 255)",
rotation: [90 + (360 / segments) * i, x, y]
});
}
return this.circle(x, y, r).attr({
fill: "r#fff-#fff",
"fill-opacity": 0,
"stroke-width": Math.round(r * .03),
stroke: "#fff"
});
};
var pi = Math.PI;
function angle(x, y) {
return (x < 0) * 180 + Math.atan(-y / -x) * 180 / pi;
}
var doc = document, win = window,
addEvent = (function () {
if (doc.addEventListener) {
return function (obj, type, fn, element) {
var f = function (e) {
return fn.call(element, e);
};
obj.addEventListener(type, f, false);
return function () {
obj.removeEventListener(type, f, false);
return true;
};
};
} else if (doc.attachEvent) {
return function (obj, type, fn, element) {
var f = function (e) {
return fn.call(element, e || win.event);
};
obj.attachEvent("on" + type, f);
var detacher = function () {
obj.detachEvent("on" + type, f);
return true;
};
return detacher;
};
}
})(),
ColorPicker = function (x, y, size, initcolor, element) {
size = size || 200;
var w3 = 3 * size / 200,
w1 = size / 200,
fi = 1.6180339887,
size20 = size / 20,
size2 = size / 2,
padding = 2 * size / 200,
height = size + size20 * 2 + padding * 3,
t = this,
H = 1, S = 1, B = 1, s = size - (size20 * 4),
r = element ? Raphael(element, size, height) : Raphael(x, y, size, height),
xy = s / 6 + size20 * 2 + padding,
wh = s * 2 / 3 - padding * 2;
w1 < 1 && (w1 = 1);
w3 < 1 && (w3 = 1);
r.colorPickerIcon(size2, size2, size2 - padding);
t.cursor = r.set();
t.cursor.push(r.circle(size2, size2, size20 / 2).attr({
stroke: "#000",
opacity: .5,
"stroke-width": w3
}));
t.cursor.push(t.cursor[0].clone().attr({
stroke: "#fff",
opacity: 1,
"stroke-width": w1
}));
t.disc = r.circle(size2, size2, size2 - padding).attr({
fill: "#000",
"fill-opacity": 0,
stroke: "none",
cursor: "crosshair"
});
var style = t.disc.node.style;
style.unselectable = "on";
style.MozUserSelect = "none";
style.WebkitUserSelect= "none";
// brightness drawing
var h = size20 * 2 + 2;
t.brect = r.rect(padding + h / fi / 2, size + padding * 2, size - padding * 2 - h / fi, h - padding * 2).attr({
stroke: "#fff",
fill: "180-#fff-#000"
});
t.cursorb = r.set();
t.cursorb.push(r.rect(size - padding - h / fi, size + padding, ~~(h / fi), h, w3).attr({
stroke: "#000",
opacity: .5,
"stroke-width": w3
}));
t.cursorb.push(t.cursorb[0].clone().attr({
stroke: "#fff",
opacity: 1,
"stroke-width": w1
}));
t.btop = t.brect.clone().attr({
stroke: "#000",
fill: "#000",
opacity: 0
});
style = t.btop.node.style;
style.unselectable = "on";
style.MozUserSelect = "none";
style.WebkitUserSelect= "none";
t.bwidth = ~~(h / fi) / 2;
t.minx = padding + t.bwidth;
t.maxx = size - h / fi - padding + t.bwidth;
t.H = t.S = t.B = 1;
t.padding = padding;
t.raphael = r;
t.size2 = size2;
t.size20 = size20;
t.x = x;
t.y = y;
// events
t.hson = addEvent(t.disc.node, "mousedown", function (e) {
var scrollY = doc.documentElement.scrollTop || doc.body.scrollTop,
scrollX = doc.documentElement.scrollLeft || doc.body.scrollLeft;
this.hsOnTheMove = true;
this.setHS(e.clientX + scrollX - this.x, e.clientY + scrollY - this.y);
this.docmove = addEvent(doc, "mousemove", this.docOnMove, this);
this.docup = addEvent(doc, "mouseup", this.docOnUp, this);
}, t);
t.bon = addEvent(t.btop.node, "mousedown", function (e) {
var scrollX = doc.documentElement.scrollLeft || doc.body.scrollLeft;
this.bOnTheMove = true;
this.setB(e.clientX + scrollX - this.x);
this.docmove = addEvent(doc, "mousemove", this.docOnMove, this);
this.docup = addEvent(doc, "mouseup", this.docOnUp, this);
}, t);
t.winunload = addEvent(win, "unload", function () {
this.hson();
this.bon();
this.docmove && this.docmove();
this.docup && this.docup();
this.winunload();
}, t);
t.color(initcolor || "#fff");
this.onchanged && this.onchanged(this.color());
};
ColorPicker.prototype.setB = function (x) {
x < this.minx && (x = this.minx);
x > this.maxx && (x = this.maxx);
this.cursorb.attr({x: x - this.bwidth});
this.B = (x - this.minx) / (this.maxx - this.minx);
this.onchange && this.onchange(this.color());
};
ColorPicker.prototype.setHS = function (x, y) {
var X = x - this.size2,
Y = y - this.size2,
R = this.size2 - this.size20 / 2 - this.padding,
d = angle(X, Y),
rd = d * pi / 180;
isNaN(d) && (d = 0);
if (X * X + Y * Y > R * R) {
x = R * Math.cos(rd) + this.size2;
y = R * Math.sin(rd) + this.size2;
}
this.cursor.attr({cx: x, cy: y});
this.H = (1 - d / 360) % 1;
this.S = Math.min((X * X + Y * Y) / R / R, 1);
this.brect.attr({fill: "180-hsb(" + [this.H, this.S] + ",1)-#000"});
this.onchange && this.onchange(this.color());
};
ColorPicker.prototype.docOnMove = function (e) {
var scrollY = doc.documentElement.scrollTop || doc.body.scrollTop,
scrollX = doc.documentElement.scrollLeft || doc.body.scrollLeft;
if (this.hsOnTheMove) {
this.setHS(e.clientX + scrollX - this.x, e.clientY + scrollY - this.y);
}
if (this.bOnTheMove) {
this.setB(e.clientX + scrollX - this.x);
}
e.preventDefault && e.preventDefault();
e.returnValue = false;
return false;
};
ColorPicker.prototype.docOnUp = function (e) {
this.hsOnTheMove = this.bOnTheMove = false;
this.docmove();
delete this.docmove;
this.docup();
delete this.docup;
this.onchanged && this.onchanged(this.color());
e.preventDefault && e.preventDefault();
e.stopPropagation && e.stopPropagation();
e.returnValue = false;
return false;
};
ColorPicker.prototype.remove = function () {
this.raphael.remove();
this.color = function () {
return false;
};
};
ColorPicker.prototype.color = function (color) {
if (color) {
color = Raphael.getRGB(color);
var hex = color.hex;
color = Raphael.rgb2hsb(color.r, color.g, color.b);
d = color.h * 360;
this.H = color.h;
this.S = color.s;
this.B = color.b;
this.cursorb.attr({x: this.B * (this.maxx - this.minx) + this.minx - this.bwidth});
this.brect.attr({fill: "180-hsb(" + [this.H, this.S] + ",1)-#000"});
var d = (1 - this.H) * 360,
rd = d * pi / 180,
R = (this.size2 - this.size20 / 2 - this.padding) * this.S,
x = Math.cos(rd) * R + this.size2,
y = Math.sin(rd) * R + this.size2;
this.cursor.attr({cx: x, cy: y});
return this;
} else {
return Raphael.hsb2rgb(this.H, this.S, this.B).hex;
}
};
})(window.Raphael);

View File

@ -0,0 +1,212 @@
(function (Raphael) {
Raphael.colorwheel = function (x, y, size, initcolor, element) {
return new ColorWheel(x, y, size, initcolor, element);
};
var pi = Math.PI;
function angle(x, y) {
return (x < 0) * 180 + Math.atan(-y / -x) * 180 / pi;
}
var doc = document, win = window;
var addEvent = (function () {
if (doc.addEventListener) {
return function (obj, type, fn, element) {
var f = function (e) {
return fn.call(element, e);
};
obj.addEventListener(type, f, false);
return function () {
obj.removeEventListener(type, f, false);
return true;
};
};
} else if (doc.attachEvent) {
return function (obj, type, fn, element) {
var f = function (e) {
return fn.call(element, e || win.event);
};
obj.attachEvent("on" + type, f);
var detacher = function () {
obj.detachEvent("on" + type, f);
return true;
};
return detacher;
};
}
})();
var ColorWheel = function (x, y, size, initcolor, element) {
size = size || 200;
var w3 = 3 * size / 200,
w1 = size / 200,
fi = 1.6180339887,
segments = pi * size / 5,
size20 = size / 20,
size2 = size / 2,
padding = 2 * size / 200,
t = this;
var H = 1, S = 1, B = 1, s = size - (size20 * 4);
var r = element ? Raphael(element, size, size) : Raphael(x, y, size, size),
xy = s / 6 + size20 * 2 + padding,
wh = s * 2 / 3 - padding * 2;
w1 < 1 && (w1 = 1);
w3 < 1 && (w3 = 1);
// ring drawing
var a = pi / 2 - pi * 2 / segments * 1.3,
R = size2 - padding,
R2 = size2 - padding - size20 * 2,
path = ["M", size2, padding, "A", R, R, 0, 0, 1, R * Math.cos(a) + R + padding, R - R * Math.sin(a) + padding, "L", R2 * Math.cos(a) + R + padding, R - R2 * Math.sin(a) + padding, "A", R2, R2, 0, 0, 0, size2, padding + size20 * 2, "z"].join();
for (var i = 0; i < segments; i++) {
r.path(path).attr({
stroke: "none",
fill: "hsb(" + i * (255 / segments) + ", 255, 200)",
rotation: [(360 / segments) * i, size2, size2]
});
}
r.path(["M", size2, padding, "A", R, R, 0, 1, 1, size2 - 1, padding, "l1,0", "M", size2, padding + size20 * 2, "A", R2, R2, 0, 1, 1, size2 - 1, padding + size20 * 2, "l1,0"]).attr({
"stroke-width": w3,
stroke: "#fff"
});
t.cursorhsb = r.set();
var h = size20 * 2 + 2;
t.cursorhsb.push(r.rect(size2 - h / fi / 2, padding - 1, h / fi, h, 3 * size / 200).attr({
stroke: "#000",
opacity: .5,
"stroke-width": w3
}));
t.cursorhsb.push(t.cursorhsb[0].clone().attr({
stroke: "#fff",
opacity: 1,
"stroke-width": w1
}));
t.ring = r.path(["M", size2, padding, "A", R, R, 0, 1, 1, size2 - 1, padding, "l1,0M", size2, padding + size20 * 2, "A", R2, R2, 0, 1, 1, size2 - 1, padding + size20 * 2, "l1,0"]).attr({
fill: "#000",
opacity: 0,
stroke: "none"
});
// rect drawing
t.main = r.rect(xy, xy, wh, wh).attr({
stroke: "none",
fill: "#f00",
opacity: 1
});
t.main.clone().attr({
stroke: "none",
fill: "0-#fff-#fff",
opacity: 0
});
t.square = r.rect(xy - 1, xy - 1, wh + 2, wh + 2).attr({
r: 2,
stroke: "#fff",
"stroke-width": w3,
fill: "90-#000-#000",
opacity: 0,
cursor: "crosshair"
});
t.cursor = r.set();
t.cursor.push(r.circle(size2, size2, size20 / 2).attr({
stroke: "#000",
opacity: .5,
"stroke-width": w3
}));
t.cursor.push(t.cursor[0].clone().attr({
stroke: "#fff",
opacity: 1,
"stroke-width": w1
}));
t.H = t.S = t.B = 1;
t.raphael = r;
t.size2 = size2;
t.wh = wh;
t.x = x;
t.xy = xy;
t.y = y;
// events
t.hsbon = addEvent(t.ring.node, "mousedown", function (e) {
this.hsbOnTheMove = true;
this.setH(e.clientX - this.x - this.size2, e.clientY - this.y - this.size2);
this.docmove = addEvent(doc, "mousemove", this.docOnMove, this);
this.docup = addEvent(doc, "mouseup", this.docOnUp, this);
}, t);
t.clron = addEvent(t.square.node, "mousedown", function (e) {
this.clrOnTheMove = true;
this.setSB(e.clientX - this.x, e.clientY - this.y);
this.docmove = addEvent(doc, "mousemove", this.docOnMove, this);
this.docup = addEvent(doc, "mouseup", this.docOnUp, this);
}, t);
t.winunload = addEvent(win, "unload", function () {
this.hsbon();
this.clron();
this.docmove && this.docmove();
this.docup && this.docup();
this.winunload();
}, t);
t.color(initcolor || "#f00");
this.onchanged && this.onchanged(this.color());
};
ColorWheel.prototype.setH = function (x, y) {
var d = angle(x, y),
rd = d * pi / 180;
this.cursorhsb.rotate(d + 90, this.size2, this.size2);
this.H = (d + 90) / 360;
this.main.attr({fill: "hsb(" + this.H + ",1,1)"});
this.onchange && this.onchange(this.color());
};
ColorWheel.prototype.setSB = function (x, y) {
x < this.size2 - this.wh / 2 && (x = this.size2 - this.wh / 2);
x > this.size2 + this.wh / 2 && (x = this.size2 + this.wh / 2);
y < this.size2 - this.wh / 2 && (y = this.size2 - this.wh / 2);
y > this.size2 + this.wh / 2 && (y = this.size2 + this.wh / 2);
this.cursor.attr({cx: x, cy: y});
this.B = 1 - (y - this.xy) / this.wh;
this.S = (x - this.xy) / this.wh;
this.onchange && this.onchange(this.color());
};
ColorWheel.prototype.docOnMove = function (e) {
if (this.hsbOnTheMove) {
this.setH(e.clientX - this.x - this.size2, e.clientY - this.y - this.size2);
}
if (this.clrOnTheMove) {
this.setSB(e.clientX - this.x, e.clientY - this.y);
}
e.preventDefault && e.preventDefault();
e.returnValue = false;
return false;
};
ColorWheel.prototype.docOnUp = function (e) {
this.hsbOnTheMove = this.clrOnTheMove = false;
this.docmove();
delete this.docmove;
this.docup();
delete this.docup;
this.onchanged && this.onchanged(this.color());
};
ColorWheel.prototype.remove = function () {
this.raphael.remove();
this.color = function () {
return false;
};
};
ColorWheel.prototype.color = function (color) {
if (color) {
color = Raphael.getRGB(color);
color = Raphael.rgb2hsb(color.r, color.g, color.b);
var d = color.h * 360;
this.H = color.h;
this.S = color.s;
this.B = color.b;
this.cursorhsb.rotate(d, this.size2, this.size2);
this.main.attr({fill: "hsb(" + this.H + ",1,1)"});
var x = this.S * this.wh + this.xy,
y = (1 - this.B) * this.wh + this.xy;
this.cursor.attr({cx: x, cy: y});
return this;
} else {
return Raphael.hsb2rgb(this.H, this.S, this.B).hex;
}
};
})(window.Raphael);

View File

@ -0,0 +1,16 @@
/*!
* Color Picker 0.1.0 - Raphael plugin
*
* Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
* Based on Color Wheel (http://jweir.github.com/colorwheel) by John Weir (http://famedriver.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
(function ($, R) {
$.fn.colorpicker = function (size, initcolor) {
if (R) {
var offset = this.offset();
return R.colorpicker(offset.left, offset.top, size, initcolor, this[0]);
}
return null;
};
})(window.jQuery, window.Raphael);

View File

@ -0,0 +1,9 @@
(function ($, R) {
$.fn.colorwheel = function (size, initcolor) {
if (R) {
var offset = this.offset();
return R.colorwheel(offset.left, offset.top, size, initcolor, this[0]);
}
return null;
};
})(window.jQuery, window.Raphael);

View File

@ -0,0 +1,53 @@
/*!
* Raphael Blur Plugin 0.1
*
* Copyright (c) 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
(function () {
if (Raphael.vml) {
var reg = / progid:\S+Blur\([^\)]+\)/g;
Raphael.el.blur = function (size) {
var s = this.node.style,
f = s.filter;
f = f.replace(reg, "");
if (size != "none") {
s.filter = f + " progid:DXImageTransform.Microsoft.Blur(pixelradius=" + (+size || 1.5) + ")";
s.margin = Raphael.format("-{0}px 0 0 -{0}px", Math.round(+size || 1.5));
} else {
s.filter = f;
s.margin = 0;
}
};
} else {
var $ = function (el, attr) {
if (attr) {
for (var key in attr) if (attr.hasOwnProperty(key)) {
el.setAttribute(key, attr[key]);
}
} else {
return doc.createElementNS("http://www.w3.org/2000/svg", el);
}
};
Raphael.el.blur = function (size) {
// Experimental. No WebKit support.
if (size != "none") {
var fltr = $("filter"),
blur = $("feGaussianBlur");
fltr.id = "r" + (Raphael.idGenerator++).toString(36);
$(blur, {stdDeviation: +size || 1.5});
fltr.appendChild(blur);
this.paper.defs.appendChild(fltr);
this._blur = fltr;
$(this.node, {filter: "url(#" + fltr.id + ")"});
} else {
if (this._blur) {
this._blur.parentNode.removeChild(this._blur);
delete this._blur;
}
this.node.removeAttribute("filter");
}
};
}
})();

View File

@ -0,0 +1,60 @@
/*!
* Raphael Path Methods Plugin 0.2
*
* Copyright (c) 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
Raphael.el.isAbsolute = true;
Raphael.el.absolutely = function () {
this.isAbsolute = 1;
return this;
};
Raphael.el.relatively = function () {
this.isAbsolute = 0;
return this;
};
Raphael.el.moveTo = function (x, y) {
this._last = {x: x, y: y};
return this.attr({path: this.attrs.path + ["m", "M"][+this.isAbsolute] + parseFloat(x) + " " + parseFloat(y)});
};
Raphael.el.lineTo = function (x, y) {
this._last = {x: x, y: y};
return this.attr({path: this.attrs.path + ["l", "L"][+this.isAbsolute] + parseFloat(x) + " " + parseFloat(y)});
};
Raphael.el.arcTo = function (rx, ry, large_arc_flag, sweep_flag, x, y, angle) {
this._last = {x: x, y: y};
return this.attr({path: this.attrs.path + ["a", "A"][+this.isAbsolute] + [parseFloat(rx), parseFloat(ry), +angle, large_arc_flag, sweep_flag, parseFloat(x), parseFloat(y)].join(" ")});
};
Raphael.el.curveTo = function () {
var args = Array.prototype.splice.call(arguments, 0, arguments.length),
d = [0, 0, 0, 0, "s", 0, "c"][args.length] || "";
this.isAbsolute && (d = d.toUpperCase());
this._last = {x: args[args.length - 2], y: args[args.length - 1]};
return this.attr({path: this.attrs.path + d + args});
};
Raphael.el.cplineTo = function (x, y, w) {
this.attr({path: this.attrs.path + ["C", this._last.x + w, this._last.y, x - w, y, x, y]});
this._last = {x: x, y: y};
return this;
};
Raphael.el.qcurveTo = function () {
var d = [0, 1, "t", 3, "q"][arguments.length],
args = Array.prototype.splice.call(arguments, 0, arguments.length);
if (this.isAbsolute) {
d = d.toUpperCase();
}
this._last = {x: args[args.length - 2], y: args[args.length - 1]};
return this.attr({path: this.attrs.path + d + args});
};
Raphael.el.addRoundedCorner = function (r, dir) {
var rollback = this.isAbsolute;
rollback && this.relatively();
this._last = {x: r * (!!(dir.indexOf("r") + 1) * 2 - 1), y: r * (!!(dir.indexOf("d") + 1) * 2 - 1)};
this.arcTo(r, r, 0, {"lu": 1, "rd": 1, "ur": 1, "dl": 1}[dir] || 0, this._last.x, this._last.y);
rollback && this.absolutely();
return this;
};
Raphael.el.andClose = function () {
return this.attr({path: this.attrs.path + "z"});
};

View File

@ -0,0 +1,99 @@
/*!
* Raphael Primitives Plugin 0.2
*
* Copyright (c) 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
Raphael.fn.star = function (cx, cy, r, r2, rays) {
r2 = r2 || r * .382;
rays = rays || 5;
var points = ["M", cx, cy + r2, "L"],
R;
for (var i = 1; i < rays * 2; i++) {
R = i % 2 ? r : r2;
points = points.concat([(cx + R * Math.sin(i * Math.PI / rays)), (cy + R * Math.cos(i * Math.PI / rays))]);
}
points.push("z");
return this.path(points.join());
};
Raphael.fn.flower = function (cx, cy, rout, rin, n) {
rin = rin || rout * .5;
n = +n < 3 || !n ? 5 : n;
var points = ["M", cx, cy + rin, "Q"],
R;
for (var i = 1; i < n * 2 + 1; i++) {
R = i % 2 ? rout : rin;
points = points.concat([+(cx + R * Math.sin(i * Math.PI / n)).toFixed(3), +(cy + R * Math.cos(i * Math.PI / n)).toFixed(3)]);
}
points.push("z");
return this.path(points);
};
Raphael.fn.spike = function (cx, cy, rout, rin, n) {
rin = rin || rout * .5;
n = +n < 3 || !n ? 5 : n;
var points = ["M", cx, cy - rout, "Q"],
R;
for (var i = 1; i < n * 2 + 1; i++) {
R = i % 2 ? rin : rout;
points = points.concat([cx + R * Math.sin(i * Math.PI / n - Math.PI), cy + R * Math.cos(i * Math.PI / n - Math.PI)]);
}
points.push("z");
return this.path(points);
};
Raphael.fn.polyline = function () {
var points = "M".concat(arguments[0] || 0, ",", arguments[1] || 0, "L");
for (var i = 2, ii = arguments.length - 1; i < ii; i++) {
points += arguments[i] + "," + arguments[++i];
}
arguments[ii].toLowerCase() == "z" && (points += "z");
return this.path(points);
};
Raphael.fn.polygon = function (cx, cy, r, n) {
n = +n < 3 || !n ? 5 : n;
var points = ["M", cx, cy - r, "L"],
R;
for (var i = 1; i < n; i++) {
points = points.concat([cx + r * Math.sin(i * Math.PI * 2 / n - Math.PI), cy + r * Math.cos(i * Math.PI * 2 / n - Math.PI)]);
}
points.push("z");
return this.path(points);
};
Raphael.fn.line = function (x1, y1, x2, y2) {
return this.path(["M", x1, y1, "L", x2, y2]);
};
Raphael.fn.drawGrid = function (x, y, w, h, wv, hv, color) {
color = color || "#000";
var path = ["M", x, y, "L", x + w, y, x + w, y + h, x, y + h, x, y],
rowHeight = h / hv,
columnWidth = w / wv;
for (var i = 1; i < hv; i++) {
path = path.concat(["M", x, y + i * rowHeight, "L", x + w, y + i * rowHeight]);
}
for (var i = 1; i < wv; i++) {
path = path.concat(["M", x + i * columnWidth, y, "L", x + i * columnWidth, y + h]);
}
return this.path(path.join(",")).attr({stroke: color});
};
Raphael.fn.square = function (cx, cy, r) {
r = r * .7;
return this.rect(cx - r, cy - r, 2 * r, 2 * r);
};
Raphael.fn.triangle = function (cx, cy, r) {
r *= 1.75;
return this.path("M".concat(cx, ",", cy, "m0-", r * .58, "l", r * .5, ",", r * .87, "-", r, ",0z"));
};
Raphael.fn.diamond = function (cx, cy, r) {
return this.path(["M", cx, cy - r, "l", r, r, -r, r, -r, -r, r, -r, "z"]);
};
Raphael.fn.cross = function (cx, cy, r) {
r = r / 2.5;
return this.path("M".concat(cx - r, ",", cy, "l", [-r, -r, r, -r, r, r, r, -r, r, r, -r, r, r, r, -r, r, -r, -r, -r, r, -r, -r, "z"]));
};
Raphael.fn.plus = function (cx, cy, r) {
r = r / 2;
return this.path("M".concat(cx - r / 2, ",", cy - r / 2, "l", [0, -r, r, 0, 0, r, r, 0, 0, r, -r, 0, 0, r, -r, 0, 0, -r, -r, 0, 0, -r, "z"]));
};
Raphael.fn.arrow = function (cx, cy, r) {
return this.path("M".concat(cx - r * .7, ",", cy - r * .4, "l", [r * .6, 0, 0, -r * .4, r, r * .8, -r, r * .8, 0, -r * .4, -r * .6, 0], "z"));
};

View File

@ -0,0 +1,52 @@
/*!
* Raphael Shadow plugin 0.3
*
* Copyright (c) 2008 - 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
Raphael.shadow = function (x, y, w, h, options) {
// options format: {
// size: 0..1, shadow size
// color: "#000", placeholder colour
// stroke: "#000", placeholder stroke colour
// shadow: "#000", shadow colour
// target: "someID" | htmlElement
// r: 5, radius of placeholder rounded corners
// }
options = options || {};
var t = ~~(size * .3 + .5),
size = (options.size || 1) * 10,
color = options.color || "#fff",
stroke = options.stroke || color,
shadowColor = options.shadow || "#000",
target = options.target || null,
R = options.r == null ? 3 : options.r,
s = size,
b = size * 2,
r = b + s,
rg = this.format("r{0}-{0}", shadowColor),
rect = "rect",
none = "none",
res,
set;
if (target) {
res = this(target, w + (x = s) * 2, h + (y = t) + b);
} else {
res = this(x - s, y - t, w + (x = s) * 2, h + (y = t) + b);
}
set = res.set(
res.rect(x - s, y - t, b + s, h + y + b).attr({stroke: none, fill: this.format("180-{0}-{0}", shadowColor), opacity: 0, "clip-rect": [x - s + 1, y - t + r, b, h + y + b - r * 2 + .9]}),
res.rect(x + w - b, y - t, b + s, h + y + b).attr({stroke: none, fill: this.format("0-{0}-{0}", shadowColor), opacity: 0, "clip-rect": [x + w - s + 1, y - t + r, b, h + y + b - r * 2]}),
res.rect(x + b - 1, y + h - s, w + b, b + s).attr({stroke: none, fill: this.format("270-{0}-{0}", shadowColor), opacity: 0, "clip-rect": [x + b, y + h - s, w + b - r * 2, b + s]}),
res.rect(x + s - 1, y - t, w + b, b + s).attr({stroke: none, fill: this.format("90-{0}-{0}", shadowColor), opacity: 0, "clip-rect": [x + b, y - t, w + b - r * 2, s + t + 1]}),
res.circle(x + b, y + h - s, r).attr({stroke: none, fill: rg, opacity: 0, "clip-rect": [x - s, y + h - s + .999, r, r]}),
res.circle(x + w - b, y + h - s, r).attr({stroke: none, fill: rg, opacity: 0, "clip-rect": [x + w - b, y + h - s, r, r]}),
res.circle(x + b, y - t + r, r).attr({stroke: none, fill: rg, opacity: 0, "clip-rect": [x - s, y - t, r, r]}),
res.circle(x + w - b, y - t + r, r).attr({stroke: none, fill: rg, opacity: 0, "clip-rect": [x + w - b, y - t, r, r]}),
res.rect(x, y, w, h, R).attr({fill: color, stroke: stroke})
);
return set[0].paper;
};

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,973 @@
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ VML Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
// └─────────────────────────────────────────────────────────────────────┘ \\
window.Raphael.vml && function (R) {
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",
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);
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));
}
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["stroke-width"] != 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 (params["stroke-dasharray"]) {
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, "&#60;").replace(/&/g, "&#38;").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(-.5, -.5);
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();
}
oldt && (this._.transform = 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;
};
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;
}
};
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.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 width = this.width,
height = this.height,
size = 1 / mmax(w / width, h / 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: size
};
this.forEach(function (el) {
el.transform("...");
});
return this;
};
var createNode;
R._engine.initWin = function (win) {
var doc = win.document;
doc.createStyleSheet().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);
}
}(window.Raphael);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,248 @@
Raphael(function () {
// TOC
(function (ol) {
if (!ol) {
return;
}
var li = document.createElement("li"),
isABBR = function (str, abbr) {
var letters = abbr.toUpperCase().split(""),
first = letters.shift(),
rg = new RegExp("^[" + first.toLowerCase() + first + "][a-z]*" + letters.join("[a-z]*") + "[a-z]*$");
return !!String(str).match(rg);
},
score = function (me, search) {
me = String(me);
search = String(search);
var score = 0,
chunk;
if (me == search) {
return 1;
}
if (!me || !search) {
return 0;
}
if (isABBR(me, search)) {
return .9;
}
score = 0;
chunk = me.toLowerCase();
for (var j, i = 0, ii = search.length; i < ii; i++) {
j = chunk.indexOf(search.charAt(i));
if (~j) {
chunk = chunk.substring(j + 1);
score += 1 / (j + 1);
}
}
score = Math.max(score / ii - Math.abs(me.length - ii) / me.length / 2, 0);
return score;
};
li.innerHTML = '<input type="search" id="dr-filter" results="0">';
var lis = ol.getElementsByTagName("span"),
names = [],
rgName = /[^\.\(]*(?=(\(\))?$)/;
for (var i = 0, ii = lis.length; i < ii; i++) {
names[i] = {
li: lis[i].parentNode.parentNode,
text: lis[i].innerHTML.match(rgName)[0]
};
}
ol.insertBefore(li, ol.firstChild);
var input = document.getElementById("dr-filter");
input.style.width = "100%";
input.style.marginTop = "10px";
input.onclick = input.onchange = input.onkeydown = input.onkeyup = function () {
var v = input.value,
res = [];
if (v.length > 1) {
for (var i = 0, ii = names.length; i < ii; i++) {
res[i] = {
li: names[i].li,
weight: score(names[i].text, v)
};
}
res.sort(function (a, b) {
return b.weight - a.weight;
});
for (i = 0, ii = res.length; i < ii; i++) {
ol.appendChild(res[i].li);
}
} else {
for (i = 0, ii = names.length; i < ii; i++) {
ol.appendChild(names[i].li);
}
}
};
})(document.getElementById("dr-toc"));
function prepare(id) {
var div = document.getElementById(id);
div.style.cssText = "float:right;padding:10px;width:99px;height:99px;background:#2C53B0 url(http://raphaeljs.com/blueprint-min.png) no-repeat";
return Raphael(div, 99, 99);
}
var line = {
stroke: "#fff",
"stroke-width": 2,
"stroke-linecap": "round",
"stroke-linejoin": "round"
},
dots = {
stroke: "#fff",
"stroke-width": 2,
"stroke-dasharray": "- ",
"stroke-linecap": "round",
"stroke-linejoin": "round"
},
fill = {
stroke: "#fff",
fill: "#fff",
"fill-opacity": .5,
"stroke-width": 2,
"stroke-linecap": "round",
"stroke-linejoin": "round"
},
none = {
fill: "#000",
opacity: 0
};
prepare("Paper.path-extra").path("M10,10R90,50 10,90").attr(line);
(function (r) {
var there;
r.circle(15, 15, 10).attr(fill).click(function () {
var clr = Raphael.hsb(Math.random(), .6, 1);
this.animate(there ? {
cx: 15,
cy: 15,
r: 10,
stroke: "#fff",
fill: "#fff"
} : {
cx: 80,
cy: 80,
r: 15,
stroke: clr,
fill: clr
}, 600, ["bounce", "<>", "elastic", ""][Math.round(Math.random() * 3)]);
there = !there;
});
})(prepare("Element.animate-extra"));
(function (r) {
var x, y;
r.circle(15, 15, 10).attr(fill).drag(function (dx, dy) {
this.attr({
cx: Math.min(Math.max(x + dx, 15), 85),
cy: Math.min(Math.max(y + dy, 15), 85)
});
}, function () {
x = this.attr("cx");
y = this.attr("cy");
});
})(prepare("Element.drag-extra"));
(function (r) {
var e = r.ellipse(50, 50, 40, 30).attr(fill).click(function () {
this.animate({
transform: "r180"
}, 1000, function () {
this.attr({
transform: ""
});
});
}),
bb = r.rect().attr(e.getBBox()).attr(dots);
eve.on("anim.frame." + e.id, function (anim) {
bb.attr(e.getBBox());
});
})(prepare("Element.getBBox-extra"));
(function (r) {
var e = r.path("M10,10R20,70 30,40 40,80 50,10 60,50 70,20 80,30 90,90").attr(line),
l = e.getTotalLength(),
to = 1;
r.customAttributes.along = function (a) {
var p = e.getPointAtLength(a * l);
return {
transform: "t" + [p.x, p.y] + "r" + p.alpha
};
};
var c = r.ellipse(0, 0, 5, 2).attr({
along: 0
}).attr(line);
r.rect(0, 0, 100, 100).attr(none).click(function () {
c.stop().animate({
along: to
}, 5000);
to = +!to;
});
})(prepare("Element.getPointAtLength-extra"));
(function (r) {
var e = r.path("M10,10R20,70 30,40 40,80 50,10 60,50 70,20 80,30 90,90").attr(line),
l = e.getTotalLength() - 10,
to = 1;
r.customAttributes.along = function (a) {
return {
path: e.getSubpath(a * l, a * l + 11)
};
};
var c = r.path().attr(line).attr({
along: 0,
stroke: "#f00",
"stroke-width": 3
});
r.rect(0, 0, 100, 100).attr(none).click(function () {
c.stop().animate({
along: to
}, 5000);
to = +!to;
});
})(prepare("Element.getSubpath-extra"));
(function (r) {
r.circle(50, 50, 40).attr(line).glow({color: "#fff"});
})(prepare("Element.glow-extra"));
(function (r) {
r.rect(10, 10, 40, 30).attr(dots);
r.rect(10, 10, 40, 30).attr(line).transform("r-30, 50, 10t10, 20s1.5");
r.text(50, 90, "r-30, 50, 10\nt10, 20s1.5").attr({fill: "#fff"});
})(prepare("Element.transform-extra"));
(function (r) {
r.circle(50, 50, 40).attr(line);
})(prepare("Paper.circle-extra"));
(function (r) {
r.ellipse(50, 50, 40, 30).attr(line);
})(prepare("Paper.ellipse-extra"));
(function (r) {
r.rect(10, 10, 50, 50).attr(line);
r.rect(40, 40, 50, 50, 10).attr(line);
})(prepare("Paper.rect-extra"));
(function (r) {
var set = r.set(
r.rect(10, 10, 50, 50).attr(fill),
r.rect(40, 40, 50, 50, 10).attr(fill)
).hover(function () {
set.stop().animate({stroke: "#f00"}, 600, "<>");
}, function () {
set.stop().animate({stroke: "#fff"}, 600, "<>");
});
})(prepare("Paper.set-extra"));
(function (r) {
r.text(50, 50, "Raphaël\nkicks\nbutt!").attr({
fill: "#fff",
font: "italic 20px Georgia",
transform: "r-10"
});
})(prepare("Paper.text-extra"));
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -0,0 +1,101 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Raphael - Integration Tests</title>
<script src="vendor/jquery.js" type="text/javascript"></script>
<script src="../raphael.js" type="text/javascript"></script>
<script type="text/javascript">
var variations = [
{stroke: "#000"},
{stroke: "#000", fill: "#000"},
{stroke: "#000", fill: "#000", opacity: .1},
{fill: "#000", stroke: "#f00", "stroke-width": "5px"}
];
function drawPrimitives(target, primitive, x, y, width, height, curve) {
var canvas = Raphael(target, 500, 120);
$.each(variations, function(index, variation) {
canvas[primitive](x + (index * 110), y, width, height, curve).attr(variation);
});
}
function embedImages(image) {
var canvas = Raphael("images", 500, 120);
canvas.image(image, 0, 5, 100, 100);
canvas.image(image, 110, 5, 100, 100).attr({opacity: "0.75"});
canvas.image(image, 220, 5, 100, 100).attr({opacity: "0.5"});
canvas.image(image, 330, 5, 100, 100).attr({opacity: "0.25"});
}
function drawLines(target, method, treatment, x, y, X, Y, width) {
var canvas = Raphael(target, 600, 120);
$.each(variations, function(index, variation) {
canvas.path(variation)[treatment]().moveTo(x + (index * 110),y)[method](X,Y, width);
});
}
function drawCurves(target, method, treatment, x, y, x1, y1, x2, y2, x3, y3) {
var canvas = Raphael(target, 600, 120);
$.each(variations, function(index, variation) {
canvas.path(variation)[treatment]().moveTo(x + (index * 110), y)[method](x1, y1, x2, y2, x3, y3);
});
}
function drawqCurves(target, method, treatment, x, y, x1, y1, x2, y2) {
var canvas = Raphael(target, 600, 120);
$.each(variations, function(index, variation) {
var c = canvas.path(variation)[treatment]().moveTo(x + (index * 110), y)[method](x1, y1, x2, y2);
alert(c.node.path);
});
}
window.onload = function () {
drawPrimitives("circles", "circle", 50, 55, 50, 50);
drawPrimitives("squares", "rect", 0, 5, 100, 100);
drawPrimitives("rounded-squares", "rect", 0, 5, 100, 100, 20);
drawPrimitives("ellipses", "ellipse", 50, 55, 50, 30);
embedImages("image/raphael.png");
drawLines("absolute-line", "lineTo", "absolutely", 5, 5, 100, 100)
drawLines("relative-line", "lineTo", "relatively", 5, 5, 100, 100)
drawLines("absolute-linec", "cplineTo", "absolutely", 5, 5, 100, 100, 50)
drawLines("relative-linec", "cplineTo", "relatively", 5, 5, 100, 100, 50)
drawCurves("absolute-curve", "curveTo", "absolutely", 5, 5, 10, 30, 90, 60, 30, 100)
drawCurves("relative-curve", "curveTo", "relatively", 5, 5, 10, 30, 90, 60, 30, 100)
drawqCurves("absolute-qcurve", "qcurveTo", "absolutely", 5, 5, 10, 50, 90, 100)
drawqCurves("relative-qcurve", "qcurveTo", "relatively", 5, 5, 10, 50, 90, 100)
};
</script>
</head>
<body>
<h1>Raphael Integration Tests</h1>
<h2>Primitives</h2>
<h3>Should draw 4 circles</h3>
<div id="circles"></div>
<h3>Should draw 4 squares</h3>
<div id="squares"></div>
<h3>Should draw 4 squares with rounded corners</h3>
<div id="rounded-squares"></div>
<h3>Should draw 4 ellipses</h3>
<div id="ellipses"></div>
<h3>Should embed 4 images with decreasing opacity</h3>
<div id="images"></div>
<h2>Paths</h2>
<h3>Should draw 4 straight lines to an absolute point</h3>
<div id="absolute-line"></div>
<h3>Should draw 4 straight lines to a relative point</h3>
<div id="relative-line"></div>
<h3>Should draw 4 curved lines to an absolute point</h3>
<div id="absolute-linec"></div>
<h3>Should draw 4 curved lines to a relative point</h3>
<div id="relative-linec"></div>
<h3>Should draw 4 bicubic curves to an absolute point</h3>
<div id="absolute-curve"></div>
<h3>Should draw 4 bicubic curves to a relative point</h3>
<div id="relative-curve"></div>
<h3>Should draw 4 quadratic curves to an absolute point</h3>
<div id="absolute-qcurve"></div>
<h3>Should draw 4 quadratic curves to a relative point</h3>
<div id="relative-qcurve"></div>
</body>
</html>

File diff suppressed because it is too large Load Diff