[108 to 112]Drag and Drop Behaviour, minor bug

Bugs will be moved here once resolved.

Post » Thu Dec 13, 2012 5:31 pm

ok. Let's see I can express the problem properly here as there are more steps and strange behaviour involved.


CAPX: https://dl.dropbox.com/u/14087254/DragAndDropBug.capx


The design
The sample uses a dual analog setup for testing purposes. The intention is that upon pressing the large circular area(pad). The DnDB object(stick) is moved to the touch position and then proceeds to have the DnDB object dragging condition.


Problem
The Drag and Drop Behaviour(DnDB)if placed into a folder for sorting will not achieve the desired above results. the behaviour object will be moved to the touch position, but will not be put into drag mode.

Steps to produce
Test A(working)
run game
put a finger on the either large circle.
Move finger around.
DnDB moves with finger as it is in "is dragging" state.

Test B(not working)
In the events. Put either stick1 or stick2 into the "PUT_STICK_IN_HERE_TO_BREAK" sub folder.
run the game
touch either large circle
move finger around
DnDB object does not move with finger as the object "is dragging" was not set. :(


There are two results from this
1. the object does not switch to dragging
2. Even if there is only one DnDB object. No other DnD objects will work.

I hope I expressed this correctly. I left two test cases inside to show that it doesn't matter which DnDB object is in a subfolder. As it does continue to affect others that are not.


Chrome, FF, Opera
Android Browser and Chrome, IOS Safari 5 and 6
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Thu Dec 13, 2012 7:01 pm

Can't reproduce in r112; works identically whether the objects are in a folder or not. Folders are not actually exported to the runtime, they only exist in the editor for organisational purposes. Therefore running the game should produce identical results regardless of folder organisation, and this is consistent with what I see. Can you provide any more details about the problem? It appears it is not related to the folders, but it could be caused by something else you've done and not mentioned here.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Dec 13, 2012 7:53 pm

Interesting, but ok. I think there was a step I missed. I agree. I wouldn't think it should have any effect on it at all. Though the result seems to occur on all my devices I test with.

I made the capx simpler just to show a single sample rather than show that it seems to effect all the DnDB objects. I moved the controller stick off for the testing purpose and I put the stick in the folder.

same location, same file name, but modified
CAPX: https://dl.dropbox.com/u/14087254/DragAndDropBug.capx


Not working sample(default)
put finger(mouse) on large grey circle(not the red stick)
Red stick will move to finger(working)
move finger. The red stick does not follow(not working)

Working sample
Take stick1 out of folder
run sample
put finger on large grey circle.
red stick moves with finger.

It's important that what is being pressed is the large grey circle and not the red stick. Pressing the large grey circle moves the stick to the finger and starts the drag and drop.


B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Fri Dec 14, 2012 5:49 pm

Ah, I see what is happening now. Your events conflict with the Drag & Drop behavior. DnD automatically handles mouse clicks and starts dragging the object. Your events move the object with the DnD behavior on a click. So now your events depend precisely on the order of whether the event or the behavior receives the click first:
If the event receives the click first, it moves the object under the mouse. Then DnD receives it second, sees the object is under the mouse, and starts dragging it.
If DnD receives the click first, it notices the object is not under the mouse, so ignores the click and does not start dragging the object. Then the event receives the click and moves the object under the mouse, but it's too late, DnD has already decided not to drag it.

You should not depend on the order of events like this, it's undefined by design. Basically, don't create events that conflict with the automatic handling done by behaviors. Rearranging the objects in the object bar can change the order in which events are received, which you shouldn't depend on anyway. Workaround: don't use a behavior, just code the events to move the object yourself. Closing as won't fix.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest