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.

Bug with mouse events on overlapping interactive elements

See original GitHub issue

Using Pixi.js 4.2.3 - ✰ WebGL ✰

I have two sprites that overlap partially. They have the following code attached for example purposes (I cut out some excess and this will need to be modified slightly to actually work):

let marker = new pixi.Sprite(this._texture);
marker.interactive = true;
marker.on('mouseover', this._onMarkerMouseOver);
marker.on('mouseout', this._onMarkerMouseOut);

notifyMouseOverMarker (spriteMarker) {
    console.log('over', spriteMarker.identifier, this._markersUnderMouse);
}

notifyMouseOutMarker (spriteMarker) {
    console.log('out', spriteMarker.identifier, this._markersUnderMouse);
}

This is what I get in my console: image

Notice that the 6cb255 marker gets the mouseout event twice, once before it even gets the mouseoverevent… ??

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
edclementcommented, Dec 13, 2016

Here is an example of the issue: https://jsfiddle.net/gf2sabv7/ Check the console to see how the wrong sprite is passed as the event.data.target

0reactions
lock[bot]commented, Feb 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug with mouse events on overlapping interactive elements
Using Pixi.js 4.2.3 - ✰ WebGL ✰ I have two sprites that overlap partially. They have the following code attached for example purposes...
Read more >
How to enable javascript mouse events on overlapping html ...
The inline html has clickable elements, and the fixed div has a hover event. The fixed element is an empty div, so it...
Read more >
[Nifty1.3] Mouse click event is delivered to all of the overlapping ...
If elements are overlapped and all elements are set to visibleToMouse(true), then all elements get the mouse click event. It seems inappropriate.
Read more >
Onover problem When moving the mouse quickly - krpano.com
The root problem here is a longstanding Chrome bug: Chrome doesn't fire 'over' events when new elements appears under the mouse.
Read more >
Controlling User Interaction on Nodes - Apple Developer
Nodes that have user interaction disabled will block touch and mouse events on nodes behind them where they overlap. See Also. Handling User...
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