BATraining / adapt-dragAndDrop-public

A drag and drop question
GNU General Public License v3.0
3 stars 8 forks source link

Randomisation #15

Open hbaileylxd opened 8 years ago

hbaileylxd commented 8 years ago

I wanted to randomise my draggable objects so I set random to true.

What it seems to do is randomise my draggable items AND my drop targets.

So I turned random to false.

Now my draggable objects are in the correct order to start with (which i don't want), but my drop targets (which I WANT in the order I added them) are mixed up!!

Any solution?

himanshu1618 commented 8 years ago

@hmaffin - First of all I would like to suggest you to use develop branch for Adapt v2, now for your current requirement you need to change these lines as follows -

        setupRandomisation: function() {
            if(this.model.get('_isEnabled')) {
                this.model.set('_draggableItems', _.shuffle(this.model.get('_draggableItems')));

                if (this.model.get('_isRandom') && !this.model.get('_isSubmitted')) {
                    this.model.set('_droppableItems', _.shuffle(this.model.get('_droppableItems')));
                }
            }
        },

Thanks!

hbaileylxd commented 8 years ago

Hmm now both my sets - drags and drops - are randomising, even though I have randomisation turned to false in the AT....

oakis commented 7 years ago

I'm having the same issue, would like the drag part to be randomized and the drop part to be in the same order everytime.

hbaileylxd commented 7 years ago

https://github.com/danielstorey/adapt-draganddrop is a good solution for now.

oakis commented 7 years ago

https://github.com/BATraining/adapt-dragAndDrop/pull/16 I did my own solution to the problem. With this it is possible to choose if you want drag or drop to be randomized, or both. :)