Simple list with drag & drop reordering

Monkey Forums/Monkey Programming/Simple list with drag & drop reordering

frank(Posted 2013) [#1]
Does anyone have code for that? Without a framework (like junglegui)?

I will try to make one myself, but if anyone has something laying around :)

If / when I have code, i'll post it here.

Thanks!

Edit: some more details; I just want to have a list with images (which is easy), then when you select/drag a row you can drag it around (easy as wel); it will show dropspots 'under' your draggable row (so the list expands/contracts based on where your draggable is) (less easy).


Gerry Quinn(Posted 2013) [#2]
I'm not sure exactly what you have in mind - do you mean something like a page in Google Images, except that you can grab a row of images and move it up or down the page?

Is the issue with actually re-ordering the list, or with rendering the page so that your dragged list has visible places to 'click' into? [My first thought would be to render from top down, adding an vertical offset based on where your mouse pointer is.]


frank(Posted 2013) [#3]
Exactly this http://jqueryui.com/sortable/ but then with 'Monkey primitives'.

Edit: I made a version but it's a hack fest :) I think I need to think about this a little more. I'll put the code online once I cleaned it (I have no shame, so it'll be horrible after cleaning as well :).

It works, but it messes up when you move / swipe fast up/down, that won't happen in real life, but people like to break things :)


Gerry Quinn(Posted 2013) [#4]
Seems like the rendering from top down would work. I don't see why move speed would be an issue - just read the mouse position once per update-render cycle.