Jump to content

Does drag and drop rely on touchenter and touchleave?


Michel (Starnut)
 Share

Recommended Posts

Hi there,

 

I've implemented a drag&drop using this code I found in the examples and then modified:

passenger.input.start(0, true);passenger.input.enableDrag(false, true, true);

This works splendid on desktop browsers and even on iOS7, but now that I wrap the game into CocoonJS it no longer works.

 

The CocoonJS log warns me, that the events touchenter and touchleave are not implemented and I've been looking through the code but couldn't find out whether these events are used for drag&drop.

 

I tested another game that uses the regular onInputDown/Up events and they seemed to work fine. So here are my questions:

 

1. Does drag&drop in Phaser rely on touchenter / touchleave (then I needn't look any further) ?

 

2. If so, is there a convenient way to do it without these events or would I have to come up with my own solution (or ask Ludei to implement these events ? ;))

 

Cheers,

Michel

Link to comment
Share on other sites

Ok here is what I JUST found out manually implementing the drag&drop checking the mousePointers.isDown state for mouse follow:

 

It seems that game.input.mousePointer is not active under CocoonJS but instead game.input.pointer1 is the active pointer. So I'm guessing that drag&drop always makes use of the mousePointer or a check in the InputHandler's _touchedHandler. For that my understanding of the code isn't deep enough.

 

I made my code work on both desktop and within the CocoonJS wrapper by using game.input.activePointer.

 

It'd be awesome if drag&drop would also work using the activePointer since that doesn't seem to be the case. Or is there a way I can pass the pointer to the drag&drop myself?

Link to comment
Share on other sites

  • 5 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...