Skip to content

Commit

Permalink
Fixed set removal process and exclude method
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBaranovskiy committed Sep 19, 2011
1 parent 2ea2ddd commit a3d3b76
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion raphael-min.js

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions raphael.core.js
Expand Up @@ -4190,7 +4190,7 @@
\*/
setproto.forEach = function (callback, thisArg) {
for (var i = 0, ii = this.items.length; i < ii; i++) {
if (callback.call(thisArg, this.items[i]) === false) {
if (callback.call(thisArg, this.items[i], i) === false) {
return this;
}
}
Expand Down Expand Up @@ -4280,13 +4280,8 @@
= (boolean) `true` if object was found & removed from the set
\*/
setproto.exclude = function (el) {
for (var i = 0, ii = this.length, found; i < ii; i++) if (found || this[i] == el) {
this[i] = this[i + 1];
found = 1;
}
if (found) {
this.length--;
delete this[i];
for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {
this.splice(i, 1);
return true;
}
};
Expand Down
24 changes: 12 additions & 12 deletions raphael.js
Expand Up @@ -1569,12 +1569,15 @@
tlen = t.length,
absolute = t[0] != (t[0] = Str(t[0]).toLowerCase()),
inver = absolute ? m.invert() : 0,
x1 = inver && inver.x(0, 0),
y1 = inver && inver.y(0, 0),
x2, y2,
x1,
y1,
x2,
y2,
bb;
if (t[0] == "t" && tlen == 3) {
if (absolute) {
x1 = inver.x(0, 0),
y1 = inver.y(0, 0),
x2 = inver.x(t[1], t[2]);
y2 = inver.y(t[1], t[2]);
m.translate(x2 - x1, y2 - y1);
Expand Down Expand Up @@ -1606,7 +1609,7 @@
if (absolute) {
x2 = inver.x(t[3], t[4]);
y2 = inver.y(t[3], t[4]);
m.scale(t[1], t[2], x2 - x1, y2 - y1);
m.scale(t[1], t[2], x2, y2);
} else {
m.scale(t[1], t[2], t[3], t[4]);
}
Expand Down Expand Up @@ -3073,7 +3076,7 @@

setproto.forEach = function (callback, thisArg) {
for (var i = 0, ii = this.items.length; i < ii; i++) {
if (callback.call(thisArg, this.items[i]) === false) {
if (callback.call(thisArg, this.items[i], i) === false) {
return this;
}
}
Expand Down Expand Up @@ -3136,13 +3139,8 @@
};

setproto.exclude = function (el) {
for (var i = 0, ii = this.length, found; i < ii; i++) if (found || this[i] == el) {
this[i] = this[i + 1];
found = 1;
}
if (found) {
this.length--;
delete this[i];
for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {
this.splice(i, 1);
return true;
}
};
Expand Down Expand Up @@ -4103,6 +4101,7 @@ window.Raphael.svg && function (R) {
if (this.removed) {
return;
}
this.paper.__set__ && this.paper.__set__.exclude(this);
eve.unbind("*.*." + this.id);
R._tear(this, this.paper);
this.node.parentNode.removeChild(this.node);
Expand Down Expand Up @@ -5036,6 +5035,7 @@ window.Raphael.vml && function (R) {
if (this.removed) {
return;
}
this.paper.__set__ && this.paper.__set__.exclude(this);
R.eve.unbind("*.*." + this.id);
R._tear(this, this.paper);
this.node.parentNode.removeChild(this.node);
Expand Down
1 change: 1 addition & 0 deletions raphael.svg.js
Expand Up @@ -873,6 +873,7 @@ window.Raphael.svg && function (R) {
if (this.removed) {
return;
}
this.paper.__set__ && this.paper.__set__.exclude(this);
eve.unbind("*.*." + this.id);
R._tear(this, this.paper);
this.node.parentNode.removeChild(this.node);
Expand Down
1 change: 1 addition & 0 deletions raphael.vml.js
Expand Up @@ -588,6 +588,7 @@ window.Raphael.vml && function (R) {
if (this.removed) {
return;
}
this.paper.__set__ && this.paper.__set__.exclude(this);
R.eve.unbind("*.*." + this.id);
R._tear(this, this.paper);
this.node.parentNode.removeChild(this.node);
Expand Down

0 comments on commit a3d3b76

Please sign in to comment.