OpenBuilds-CONTROL icon indicating copy to clipboard operation
OpenBuilds-CONTROL copied to clipboard

Move Macros Issue with > 9 Macros

Open sharmstr opened this issue 2 years ago • 4 comments

Hey Peter, There's an issue with moving macros when there is more than 9 of them. Instead of moving the macro it will duplicate it.

Check out the following video.

https://youtu.be/f7QdChPJMVs

sharmstr avatar Jun 25 '23 15:06 sharmstr

Good catch, weird one, I don't see anything obvious in the sorting code. Does it affect just the rendering, or also the stored macros in localStorage (Does an F5 refresh fix it?)

petervanderwalt avatar Jun 27 '23 20:06 petervanderwalt

It gets stored. Wish I had time to dig into it. As usual it really only effects me. LOL. Just leave this open and one of us will get to it eventually.

Might have something to do with alpha sorting instead of numeric? idk

sharmstr avatar Jun 27 '23 20:06 sharmstr

My guess was right. Its a alpha sorting issue.

In sortMacros functions, change

var indexes = [index, newIndex].sort(); //Sort the indixes

to

var indexes = [index, newIndex].sort((a,b)=>a-b); //Sort the indixes

sharmstr avatar Jun 28 '23 16:06 sharmstr

opened so I remember to apply, thanks for finding the fix

petervanderwalt avatar Jun 29 '23 18:06 petervanderwalt