How do I find and remove objects in an array?
-
@d-healey
I found where the problem is taking place:selectedNotes.push ( selectedNotes.filter(function (c) { var cx = c.col * cellWidth; var cy = height - (c.row + 1) * cellHeight; return ( cx + cellWidth > x1 && cx < x2 && cy + cellHeight > y1 && cy < y2 ); }) );
This selectedNotes.push is pushing an object inside an array to the selectedNotes array, whereas I only need it to push an object to the array.
So the current result is looking like [[{"row":42, "col":4}]]
but I need it to just look like [{"row":42, "col":4}]
I am not sure how I modify that to just use a the object and not have it wrapped in that extra array. -
@VirtualVirgin Add
[0]
after the parenthesis -
@d-healey Almost...
that turns it into an object, but it only returns one selection to the list instead of all of the noteCells under the selection rectangle area.
Without the [0] it returns all of them, but inside an array. -
@VirtualVirgin In that case after it returns them, just grab the [0] element from that array.
-
@d-healey Whoops... is there a panic button of some sort for feedback loops? I got stuck in one.
-
@VirtualVirgin What do you mean?
-
@d-healey I added a for loop after that function and it seems to be stuck in the loop
-
@VirtualVirgin What does the loop do?
-
for (i = 0; i < noteCells; i++) selectedNotes.push(noteCells[i]);
It's not resolving because I meant to use "i < noteCells.length",
so I am stuck with a spinning wheel and a sluggish HISE.I'll just force quit it.
Just didn't know if there is a button similar to "all notes off" to stop the processing. -
@VirtualVirgin Can you just hit compile again?