Commit 52bff469 by Dmitry Baranovskiy

Cleaning up old files

parent 7ba1a825
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;
}
\ No newline at end of file
(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);
/*!
* 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);
\ No newline at end of file
(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);
\ No newline at end of file
/*!
* 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");
}
};
}
})();
\ No newline at end of file
/*!
* 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"});
};
/*!
* 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"));
};
/*!
* 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;
};
This source diff could not be displayed because it is too large. You can view the blob instead.
<!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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment