Update raphael.js to 2.2.1

This commit is contained in:
Garret Wassermann 2017-05-26 15:24:34 -04:00
parent b0677037ff
commit f05f45adce
2 changed files with 121 additions and 61 deletions

View File

@ -271,7 +271,7 @@ return /******/ (function(modules) { // webpackBootstrap
width: 0, width: 0,
x: 0, x: 0,
y: 0, y: 0,
class: "" "class": ""
}, },
availableAnimAttrs = R._availableAnimAttrs = { availableAnimAttrs = R._availableAnimAttrs = {
blur: nu, blur: nu,
@ -444,7 +444,6 @@ return /******/ (function(modules) { // webpackBootstrap
\*/ \*/
R.fn = paperproto = Paper.prototype = R.prototype; R.fn = paperproto = Paper.prototype = R.prototype;
R._id = 0; R._id = 0;
R._oid = 0;
/*\ /*\
* Raphael.is * Raphael.is
[ method ] [ method ]
@ -5499,15 +5498,16 @@ return /******/ (function(modules) { // webpackBootstrap
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// ┌────────────────────────────────────────────────────────────┐ \\ // ┌────────────────────────────────────────────────────────────┐ \\
// │ Eve 0.4.2 - JavaScript Events Library │ \\ // │ Eve 0.5.0 - JavaScript Events Library │ \\
// ├────────────────────────────────────────────────────────────┤ \\ // ├────────────────────────────────────────────────────────────┤ \\
// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\ // │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
// └────────────────────────────────────────────────────────────┘ \\ // └────────────────────────────────────────────────────────────┘ \\
(function (glob) { (function (glob) {
var version = "0.4.2", var version = "0.5.0",
has = "hasOwnProperty", has = "hasOwnProperty",
separator = /[\.\/]/, separator = /[\.\/]/,
comaseparator = /\s*,\s*/,
wildcard = "*", wildcard = "*",
fun = function () {}, fun = function () {},
numsort = function (a, b) { numsort = function (a, b) {
@ -5516,6 +5516,26 @@ return /******/ (function(modules) { // webpackBootstrap
current_event, current_event,
stop, stop,
events = {n: {}}, events = {n: {}},
firstDefined = function () {
for (var i = 0, ii = this.length; i < ii; i++) {
if (typeof this[i] != "undefined") {
return this[i];
}
}
},
lastDefined = function () {
var i = this.length;
while (--i) {
if (typeof this[i] != "undefined") {
return this[i];
}
}
},
objtos = Object.prototype.toString,
Str = String,
isArray = Array.isArray || function (ar) {
return ar instanceof Array || objtos.call(ar) == "[object Array]";
};
/*\ /*\
* eve * eve
[ method ] [ method ]
@ -5528,10 +5548,9 @@ return /******/ (function(modules) { // webpackBootstrap
- scope (object) context for the event handlers - scope (object) context for the event handlers
- varargs (...) the rest of arguments will be sent to event handlers - varargs (...) the rest of arguments will be sent to event handlers
= (object) array of returned values from the listeners = (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value.
\*/ \*/
eve = function (name, scope) { eve = function (name, scope) {
name = String(name);
var e = events, var e = events,
oldstop = stop, oldstop = stop,
args = Array.prototype.slice.call(arguments, 2), args = Array.prototype.slice.call(arguments, 2),
@ -5544,6 +5563,8 @@ return /******/ (function(modules) { // webpackBootstrap
out = [], out = [],
ce = current_event, ce = current_event,
errors = []; errors = [];
out.firstDefined = firstDefined;
out.lastDefined = lastDefined;
current_event = name; current_event = name;
stop = 0; stop = 0;
for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) { for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
@ -5589,7 +5610,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
stop = oldstop; stop = oldstop;
current_event = ce; current_event = ce;
return out.length ? out : null; return out;
}; };
// Undocumented. Debug only. // Undocumented. Debug only.
eve._events = events; eve._events = events;
@ -5606,7 +5627,7 @@ return /******/ (function(modules) { // webpackBootstrap
= (array) array of event handlers = (array) array of event handlers
\*/ \*/
eve.listeners = function (name) { eve.listeners = function (name) {
var names = name.split(separator), var names = isArray(name) ? name : name.split(separator),
e = events, e = events,
item, item,
items, items,
@ -5636,7 +5657,25 @@ return /******/ (function(modules) { // webpackBootstrap
} }
return out; return out;
}; };
/*\
* eve.separator
[ method ]
* If for some reasons you dont like default separators (`.` or `/`) you can specify yours
* here. Be aware that if you pass a string longer than one character it will be treated as
* a list of characters.
- separator (string) new separator. Empty string resets to default: `.` or `/`.
\*/
eve.separator = function (sep) {
if (sep) {
sep = Str(sep).replace(/(?=[\.\^\]\[\-])/g, "\\");
sep = "[" + sep + "]";
separator = new RegExp(sep);
} else {
separator = /[\.\/]/;
}
};
/*\ /*\
* eve.on * eve.on
[ method ] [ method ]
@ -5646,37 +5685,44 @@ return /******/ (function(modules) { // webpackBootstrap
| eve("mouse.under.floor"); // triggers f | eve("mouse.under.floor"); // triggers f
* Use @eve to trigger the listener. * Use @eve to trigger the listener.
** **
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function - f (function) event handler function
** **
- name (array) if you dont want to use separators, you can use array of strings
- f (function) event handler function
**
= (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment. = (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
> Example: > Example:
| eve.on("mouse", eatIt)(2); | eve.on("mouse", eatIt)(2);
| eve.on("mouse", scream); | eve.on("mouse", scream);
| eve.on("mouse", catchIt)(1); | eve.on("mouse", catchIt)(1);
* This will ensure that `catchIt()` function will be called before `eatIt()`. * This will ensure that `catchIt` function will be called before `eatIt`.
* *
* If you want to put your handler before non-indexed handlers, specify a negative value. * If you want to put your handler before non-indexed handlers, specify a negative value.
* Note: I assume most of the time you dont need to worry about z-index, but its nice to have this feature just in case. * Note: I assume most of the time you dont need to worry about z-index, but its nice to have this feature just in case.
\*/ \*/
eve.on = function (name, f) { eve.on = function (name, f) {
name = String(name);
if (typeof f != "function") { if (typeof f != "function") {
return function () {}; return function () {};
} }
var names = name.split(separator), var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);
e = events; for (var i = 0, ii = names.length; i < ii; i++) {
(function (name) {
var names = isArray(name) ? name : Str(name).split(separator),
e = events,
exist;
for (var i = 0, ii = names.length; i < ii; i++) { for (var i = 0, ii = names.length; i < ii; i++) {
e = e.n; e = e.n;
e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}}); e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}});
} }
e.f = e.f || []; e.f = e.f || [];
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) { for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
return fun; exist = true;
break;
}
!exist && e.f.push(f);
}(names[i]));
} }
e.f.push(f);
return function (zIndex) { return function (zIndex) {
if (+zIndex == +zIndex) { if (+zIndex == +zIndex) {
f.zIndex = +zIndex; f.zIndex = +zIndex;
@ -5729,10 +5775,11 @@ return /******/ (function(modules) { // webpackBootstrap
= (boolean) `true`, if current events name contains `subname` = (boolean) `true`, if current events name contains `subname`
\*/ \*/
eve.nt = function (subname) { eve.nt = function (subname) {
var cur = isArray(current_event) ? current_event.join(".") : current_event;
if (subname) { if (subname) {
return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event); return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(cur);
} }
return current_event; return cur;
}; };
/*\ /*\
* eve.nts * eve.nts
@ -5744,7 +5791,7 @@ return /******/ (function(modules) { // webpackBootstrap
= (array) names of the event = (array) names of the event
\*/ \*/
eve.nts = function () { eve.nts = function () {
return current_event.split(separator); return isArray(current_event) ? current_event : current_event.split(separator);
}; };
/*\ /*\
* eve.off * eve.off
@ -5769,8 +5816,15 @@ return /******/ (function(modules) { // webpackBootstrap
eve._events = events = {n: {}}; eve._events = events = {n: {}};
return; return;
} }
var names = name.split(separator), var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator);
e, if (names.length > 1) {
for (var i = 0, ii = names.length; i < ii; i++) {
eve.off(names[i], f);
}
return;
}
names = isArray(name) ? name : Str(name).split(separator);
var e,
key, key,
splice, splice,
i, ii, j, jj, i, ii, j, jj,
@ -5839,7 +5893,7 @@ return /******/ (function(modules) { // webpackBootstrap
\*/ \*/
eve.once = function (name, f) { eve.once = function (name, f) {
var f2 = function () { var f2 = function () {
eve.unbind(name, f2); eve.off(name, f2);
return f.apply(this, arguments); return f.apply(this, arguments);
}; };
return eve.on(name, f2); return eve.on(name, f2);
@ -6522,8 +6576,17 @@ return /******/ (function(modules) { // webpackBootstrap
* Unique id of the element. Especially useful when you want to listen to events of the element, * Unique id of the element. Especially useful when you want to listen to events of the element,
* because all events are fired in format `<module>.<action>.<id>`. Also useful for @Paper.getById method. * because all events are fired in format `<module>.<action>.<id>`. Also useful for @Paper.getById method.
\*/ \*/
this.id = R._oid++; this.id = guid();
node.raphaelid = this.id; node.raphaelid = this.id;
/**
* Method that returns a 5 letter/digit id, enough for 36^5 = 60466176 elements
* @returns {string} id
*/
function guid() {
return ("0000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5);
}
this.matrix = R.matrix(); this.matrix = R.matrix();
this.realPath = null; this.realPath = null;
/*\ /*\
@ -6730,9 +6793,6 @@ return /******/ (function(modules) { // webpackBootstrap
this.attr({"stroke-width": sw}); this.attr({"stroke-width": sw});
} }
//Reduce transform string
_.transform = this.matrix.toTransformString();
return this; return this;
}; };
/*\ /*\

File diff suppressed because one or more lines are too long