Remove redundant (and incorrect) length set. (#256)
* Remove redundant (and incorrect) length set. Fixes issue #255 * Simplify code by using push instead of a variablemaster
parent
e7f3fbc841
commit
a2df54881f
|
@ -1108,17 +1108,14 @@ const selectOnly = this.selectOnly = function (elems, showGrips) {
|
||||||
if (!elemsToRemove.length) { return; }
|
if (!elemsToRemove.length) { return; }
|
||||||
|
|
||||||
// find every element and remove it from our array copy
|
// find every element and remove it from our array copy
|
||||||
let j = 0;
|
|
||||||
const newSelectedItems = [],
|
const newSelectedItems = [],
|
||||||
len = selectedElements.length;
|
len = selectedElements.length;
|
||||||
newSelectedItems.length = len;
|
|
||||||
for (let i = 0; i < len; ++i) {
|
for (let i = 0; i < len; ++i) {
|
||||||
const elem = selectedElements[i];
|
const elem = selectedElements[i];
|
||||||
if (elem) {
|
if (elem) {
|
||||||
// keep the item
|
// keep the item
|
||||||
if (!elemsToRemove.includes(elem)) {
|
if (!elemsToRemove.includes(elem)) {
|
||||||
newSelectedItems[j] = elem;
|
newSelectedItems.push(elem);
|
||||||
j++;
|
|
||||||
} else { // remove the item and its selector
|
} else { // remove the item and its selector
|
||||||
selectorManager.releaseSelector(elem);
|
selectorManager.releaseSelector(elem);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue