mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
One more simplification.
This commit is contained in:
parent
2bb3df3314
commit
0ce825f8c9
1 changed files with 4 additions and 5 deletions
|
@ -482,12 +482,11 @@ new function() { // Scope for statics
|
|||
l = 0,
|
||||
r = length - 1;
|
||||
|
||||
function check(index, dir) {
|
||||
function check(index) {
|
||||
// If we reach the beginning/end of the list, compare with the
|
||||
// location at the other end, as paths are circular lists.
|
||||
var i = index + dir,
|
||||
loc2 = locations[i >= 0 && i < length
|
||||
? i : (i < 0 ? length - 1 : 0)];
|
||||
var loc2 = locations[index >= 0 && index < length
|
||||
? index : (index < 0 ? length - 1 : 0)];
|
||||
return loc.equals(loc2) ? loc2 : null;
|
||||
}
|
||||
|
||||
|
@ -498,7 +497,7 @@ new function() { // Scope for statics
|
|||
// See if the two locations are actually the same, and merge if
|
||||
// they are. If they aren't, check the neighbors through check()
|
||||
if (merge && (found = loc.equals(loc2) ? loc2
|
||||
: (check(m, -1) || check(m, 1)))) {
|
||||
: (check(m - 1) || check(m + 1)))) {
|
||||
// We're done, don't insert, merge with the found location
|
||||
// instead, and carry over overlap:
|
||||
if (loc._overlap) {
|
||||
|
|
Loading…
Reference in a new issue