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.

Event capture not supported, fine. But capture not even hackable outside of pixi, NOT fine!

See original GitHub issue

Hi, I’ve been stumbling on this problem a couple of times now so I think it’s in place to get this clarified once and for all.

I know the capture phase is not supported by pixijs. That’s OK for now. However, when I try to catch events this way I would expect it to work properly (pixiCanvas is my renderer’s view element): pixiCanvas.addEventListener('mousedown' , this.onPointerDownCapture, true); this.on("mousedown" , this.onPointerDown, this);

When I do this, onPointerDown is called BEFORE onPointerDownCapture, which is extremely annoying because it means I cannot hack around to get any type of capture working as long as pixi is loaded onto the page. And I really have to capture it before in order to have a proper and simple design for my event handling code…

If I recall my last investigation correctly I think that pixi attaches its listeners to the window, the topmost possible object, which I think is the reason why it is so hard to hack around it. If an event is captured there, the only option to have a chance capturing it before pixi is to make a really ugly hack to get my handler added to window before pixi is even loaded. Maybe possible, but that would be really ugly and require a huge inline comment to explain why that has to be done.

Maybe I have missed something fundamental. If so, please let me know. Otherwise my suggestion is that we ensure that pixi never attaches any listeners to elements above its view in the page element hierarchy.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
molstcommented, Jan 29, 2020

I managed to solve my problem another way, involving attachment of data to the bubbling events. However, still, for the future I think the attachement of capturing event handlers to window and window.document should be revised and changed if possible. I suppose it should be possible to attach them to the renderer view element instead, but maybe there is some reason why it had to be done this way. If so, an explanation here would be great.

1reaction
molstcommented, Jan 28, 2020

Thanks, Ivan, for the fast reply, the code pointer, and for all your great posts that have helped me a lot so far!

I’ll try to avoid hacking pixi as much as I can (for a rock solid upgrade process), but I’ll let you know if I fall back to replace addEvents!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event capture not supported, fine. But capture not ... - GitHub
I know the capture phase is not supported by pixijs. That's OK for now. ... But capture not even hackable outside of pixi,...
Read more >
Advanced interaction event handling - Pixi.js
Let's say I click on a sprite, which might be nested in other containers and so on, each with their own onclick event...
Read more >
Stealing Wi-Fi Passwords with an Evil Twin Attack « Null Byte
This forces the victim to connect to the fake network and supply the Wi-Fi password to regain internet access. While a more technical...
Read more >
Ecamm Live Community | HELP! My Facebook Live video comes out ...
HELP! My Facebook Live video comes out completely distorted. Can someone tell me how to fix that? I have to do a FB...
Read more >
CTF Hacking: What is Capture the Flag for a Newbie?
CTFs are events that are usually hosted at information security ... So not only are CTF events fun, they can also be educational...
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