Commit b15a86d8 by Tomas Alabes

Improved element ids, suggested by @dpcouch

parent 5fec7097
...@@ -369,7 +369,6 @@ define(["eve"], function(eve) { ...@@ -369,7 +369,6 @@ define(["eve"], function(eve) {
\*/ \*/
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 ]
......
...@@ -658,8 +658,17 @@ define(["./raphael.core"], function(R) { ...@@ -658,8 +658,17 @@ define(["./raphael.core"], function(R) {
* 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;
/*\ /*\
......
2.2.2 (WIP)
------------------
* Improved elements ids, so multiple raphael instances are more reliable
2.2.1 2.2.1
------------------ ------------------
* Removed name of amd module * Removed name of amd module
......
...@@ -444,7 +444,6 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -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 ]
...@@ -6522,8 +6521,17 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -6522,8 +6521,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;
/*\ /*\
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -444,7 +444,6 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -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 ]
...@@ -6151,8 +6150,17 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -6151,8 +6150,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;
/*\ /*\
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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