Jump to content

Pixi game in iFrame not scrolling / swiping


NickT
 Share

Recommended Posts

Hi folks, 

 

I have a game built in Pixi, pulled into a website in an iFrame. The game takes up most of the screen except for a menu at top and a footer at bottom. The bottom of the game and the footer are off the bottom of the screen and I want the player to be able to scroll / swipe to see the bottom of the game and the footer of the site.

 

It appears that since almost all of the visible screen is the canvas, the swipes are not picked up by the main site and so the site doesn't scroll.

 

Any thoughts on how to get this to work?

 

Thanks,

Link to comment
Share on other sites

  • 1 month later...

I've encountered this too. What I ended up doing is modifying pixi.js to not "prevent default" if the tap is also a drag (there are some "if" blocks to work with here). But I had to re-minify the dev version and it's not really ideal to be stuck doing that.

 

The most simple way I've found without modifying pixi.js is to set this at the top of your code.

PIXI.AUTO_PREVENT_DEFAULT = false;

But it won't prevent touch-scrolls or pinch-zooms from pressing buttons if you touch that area to scroll. It might work for your purposes. Unless there's a way to prevent default on your buttons on an individual basis, which I haven't looked at yet.

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...