proyecto26 / ion-phaser

A web component to use Phaser Framework with Angular, React, Vue, etc 🎮
https://market.ionicframework.com/plugins/ionphaser
MIT License
251 stars 39 forks source link

Pointer events shift when scrolling the canvas #24

Closed aldebout closed 3 years ago

aldebout commented 3 years ago

I'm using the react package.

When I scroll the page on which the canvas is present after the game has loaded, subsequent calls to pointer.y get shifted by the scroll amount.

My game config:

{
  type: Phaser.AUTO,
  scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    width: 700,
    height: 700,
  },
  scene: playGame,
}

My jsx:

<IonPhaser
    style={{
      width: '350px',
      height: '350px',
    }}
    key={gameId}
    game={game}
    initialize={initialize}
  />

and the game is basically taken from here.

Edit: After further testing, it's also the case without the position absolute, reflected it in my code.

jdnichollsc commented 3 years ago

Can you attach a GitHub repo to be able to reproduce this issue? :)

jdnichollsc commented 3 years ago

@aldebout please create a demo to reopen this issue, try here: https://stackblitz.com