Skip to content

Projector use of this.scene.sys.game.config cause problems if width and height in config not in pixels #21

@PaulMuller

Description

@PaulMuller
project(point3, out = new Point()) {
    out.x = (point3.x - point3.y) * this._transform[0];
    out.y = ((point3.x + point3.y) * this._transform[1]) - point3.z;

    const { width, height } = this.scene.sys.game.config;

    out.x += width * this.origin.x;
    out.y += height * this.origin.y;

    return out;
  }

this code returns NaN for 'x' and 'y', because of my game config

const config = {
  type: Phaser.AUTO,
  scale: {
      mode: Phaser.Scale.RESIZE,
      width: '100vw',
      height: '100vh',
      autoCenter: Phaser.Scale.CENTER_BOTH
  },
  ...
}

May better solution to use const { width, height } = this.sys.game.canvas ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions