# Pointerdown event returns weird pointer coordinates when on Phaser.Scale.FIT scale mode

**URL:** https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953
**Category:** Phaser 3
**Created:** [April 2, 2019, 11:04am UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953 "2019-04-02T11:04:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![glantucan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/glantucan/32/920_2.png) [@glantucan](https://phaser.discourse.group/u/glantucan)
#### Post date: [April 2, 2019, 11:04am UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953/1 "2019-04-02T11:04:42Z")

</div>

Hi,  
I’m not sure if this is a bug or is it that I’m doing something wrong:  
I have this:

```javascript
var config = {
    type: Phaser.AUTO,
    parent: gameConfig.parentId,
    scale: {
        width: screen.width,
        height: screen.height,
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
        autoRound: true,
    },
    render: {
        transparent:true,
    },
    scene: [Scene01(gameConfig.mainScnConfig)]
};
var game = new Phaser.Game(config);

```

And the on the scene create function I do:

```javascript
  //...
  this.input.on('pointerdown', onPointerDown);
}

function onPointerDown(pointer, currentyOver) {
    console.log('pointerdown', pointer.x, pointer.y);
}

```

The pointer x and y are completely off. Please help!

---

<div class="post-metadata">

### Author: ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yannick/32/732_2.png) [@yannick](https://phaser.discourse.group/u/yannick)
#### Post date: [April 2, 2019, 11:44am UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953/2 "2019-04-02T11:44:41Z")

</div>

Maybe you are just confusing pointer.x and pointer.worldX?

The way you have it now should return {x: 0, y: 0}, if you click the top left corner of the canvas and {x: gameWidth, y: gameHeight} if you click on the bottom right corner of the canvas.

---

<div class="post-metadata">

### Author: ![glantucan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/glantucan/32/920_2.png) [@glantucan](https://phaser.discourse.group/u/glantucan)
#### Post date: [April 2, 2019, 11:52am UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953/3 "2019-04-02T11:52:52Z")

</div>

No, pointer.x and pointer.worldX have the same values.

And in my case on the top left they return {x:686.4, y:440.8} and on the bottom right {x:1233.6, y:638.3} 😧 . Width and height are set to screen width and height which in my monitor should be 1920x1080 pixels

What I also find weird is that if I click outside of the canvas the event is fired too

---

<div class="post-metadata">

### Author: ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yannick/32/732_2.png) [@yannick](https://phaser.discourse.group/u/yannick)
#### Post date: [April 2, 2019, 11:57am UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953/4 "2019-04-02T11:57:41Z")

</div>

Ok. So then maybe something in your html or css file is wrong? Because your GameConfigs seems to be right.

I once made a [simple phaser template](https://github.com/yandeu/phaser-basic-template) which uses the same setting. Maybe it helps taking a loot at it?

---

<div class="post-metadata">

### Author: ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yannick/32/732_2.png) [@yannick](https://phaser.discourse.group/u/yannick)
#### Post date: [April 2, 2019, 12:02pm UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953/5 "2019-04-02T12:02:02Z")

</div>

Oh no I see something! Maybe you just have to put the `parent` inside the `scale` object?

---

<div class="post-metadata">

### Author: ![glantucan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/glantucan/32/920_2.png) [@glantucan](https://phaser.discourse.group/u/glantucan)
#### Post date: [April 2, 2019, 12:05pm UTC](https://phaser.discourse.group/t/pointerdown-event-returns-weird-pointer-coordinates-when-on-phaser-scale-fit-scale-mode/1953/6 "2019-04-02T12:05:04Z")

</div>

Thanks a lot Yannick! You gave the clue. It was the css. I forgot to remove this property from the canvas CSS from a previous test I was doing (stupid of me!!)

```javascript
border: solid 1000px white;

```

I removed it and it works!
