Michel (Starnut) Posted January 20, 2014 Share Posted January 20, 2014 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 More sharing options...
rich Posted January 20, 2014 Share Posted January 20, 2014 No it doesn't use onTouchEnter or Leave because there's nothing for it to enter or leave (they only fire on DOM objects iirc, and the canvas is the only DOM object on the page). It uses touchStart, touchMove and touchEnd. Link to comment Share on other sites More sharing options...
Michel (Starnut) Posted January 21, 2014 Author Share Posted January 21, 2014 Hey, rich, thanks for the info!But that's really weird then: How come onInputDown / onInputUp work fine while drag&drop doesn't? They're probably using touchStart and touchEnd as well, right? Any ideas come to mind in which direction I could keep investigating? Link to comment Share on other sites More sharing options...
Michel (Starnut) Posted January 21, 2014 Author Share Posted January 21, 2014 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 More sharing options...
jordibar Posted July 3, 2014 Share Posted July 3, 2014 Hi Michel, could you explain me how do you do to drag sprite in cocoonjs, please?! Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts