Jump to content

Touch dragging broken in v3.0.7?


MercuryAX
 Share

Recommended Posts

Hi all,

 

I just updated my pixi version to 3.0.7 and am now experiencing an issue with dragging sprites using the touch screen on mobile devices.

 

My original mouse/touch dragging code was based on this example in Pixi 2.x: http://www.goodboydigital.com/pixijs/examples/8/

 

Originally, you would use 

this.sy = this.data.getLocalPosition(this).y * this.scale.y;

in order to get the global y coordinate of a sprite, for example.  I changed this to  

this.sy = renderer.plugins.interaction.mouse.global.y * this.scale.y;

for compatibility with Pixi 3.x.

 

My problem is, this works fine for dragging sprites with a mouse, but seems to be extremely sensitive on a touch screen (moving my sprite way more than it should be).  Here is what I'm working on now: http://mercuryax.org/stacks/

 

Has anybody had a similar issue when upgrading, or in other scenarios, and has been able to fix it?

 

Thank You.

Link to comment
Share on other sites

Thank you, this worked great!  My issue with mobile touch dragging is fixed.  One last thing I'd like to ask if you don't mind.  When pushing my game project files to github (even after compiling pixi with dev branch) it seems that the issue persists with the downloaded project.  Do you know why this would happen?

Link to comment
Share on other sites

Sadly, after a clean build of the dev branch, I'm now back to the original problem.  I have not been able to reproduce the success I had earlier, and I can confirm that it's not a caching issue at least on the client side.  Any more recommendations?  I could always wait until the next release, that might fix it any build-related problems.  

Link to comment
Share on other sites

It's on my original post.  Here's another copy: http://mercuryax.org/stacks/

 

This is a prototype of a block-based game where you drag colored blocks vertically in columns to match like-colored blocks (currently only horizontally).  Similar to Meteos.  

 

Currently, dragging the blocks up and down only works on the desktop and not on mobile, where they will only move up (and move more than they should).

 

EDIT: Nevermind, I fixed everything by following the new examples.  I'm an idiot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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