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; }
|
||||
|
||||
// find every element and remove it from our array copy
|
||||
let j = 0;
|
||||
const newSelectedItems = [],
|
||||
len = selectedElements.length;
|
||||
newSelectedItems.length = len;
|
||||
for (let i = 0; i < len; ++i) {
|
||||
const elem = selectedElements[i];
|
||||
if (elem) {
|
||||
// keep the item
|
||||
if (!elemsToRemove.includes(elem)) {
|
||||
newSelectedItems[j] = elem;
|
||||
j++;
|
||||
newSelectedItems.push(elem);
|
||||
} else { // remove the item and its selector
|
||||
selectorManager.releaseSelector(elem);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue