question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PointerOver / PointerOut events only fire when clicking

See original GitHub issue

Version

  • Phaser Version: 3.17.0
  • Operating system: Win64
  • Browser: Google Chrome

Description

I am registering pointerover and pointerout events for a game object so I can create a hover effect, but it seems like these events are not firing when I hover over it. They only fire when I click and hold down the mouse button, but then, they also only fire once. Is this intended, or a I doing something wrong?

Example Test Code

        this.sprite = scene.add.image(this.x, this.y, this.template.id);

        // Register a handler for when the user clicks on this sprite
        this.sprite.on("pointerup", function() {
            this.template.onInteract(this);
        }, this);

        // Register a handler for when the users mouse hovers over the sprite
        this.sprite.on("pointerover", function() {
            console.log("hover");
        }, this);

        this.sprite.on("pointerout", function() {
            console.log("out");
        })

        // Enable interactivity so pointer events actually fire
        this.sprite.setInteractive();

Additional Information

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
justincooper-415commented, Dec 18, 2020

I found on Mac, using Chrome 87.0.4280.88, the chrome developer console interfered with the pointerover events. So you might want to just turn off your dev console (if it’s open) to see if its the source of your problem.

1reaction
Abhay-soni-developercommented, Aug 12, 2021

i think the problem is while you have opened your dev tools you have choose mobile view , and mobile does not have pointer thats why your pointer over and out works only on clicking. please close the dev tool or just change from mobile view to desktop and things will work out smooth for you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pointer events - Web APIs | MDN
A browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device...
Read more >
Is there a pointer event that equals to 'click' event?
This means "click" event is generic, it will tell you "what clicked" in its event details. At least on chrome. Edit: I just...
Read more >
Pointer Events - W3C
Only a primary pointer will produce compatibility mouse events. ... A user agent MUST fire a pointer event named pointerover when a pointing ......
Read more >
Pointer events - The Modern JavaScript Tutorial
Long ago, in the past, there were only mouse events. ... The pointercancel event fires when there's an ongoing pointer interaction, ...
Read more >
Pointer events - Unity - Manual
Target: {(evt.target as VisualElement).name}"); } private void OnPointerOutEvent(PointerOutEvent evt) { Debug.Log($"Pointer OUT Event.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found