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.

PIXI.Container don't have method containsPoint cause event cannot be triggered at Container

See original GitHub issue
let app = new PIXI.Application(800, 600);
document.body.appendChild(app.view);
app.stage.interactive = true;
app.stage.on('click', () => {
    console.log('CLICKED');
})

Expect Click on stage would trigger click event.

Actual Nothing triggered

Found out the reason is PIXI.Container doesn’t have method containsPoint, and it lead to hitTest is skiped.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
ivanpopelyshevcommented, Dec 28, 2017

By the way, about box - if you try to use width and height on containers, they also work Flash way, so prepare to study docs and sources about it.

It would be good if someone implements containers for for web-devs based on their DOM experience, you should go for it 😃 Basic pixi container: https://github.com/pixijs/pixi.js/blob/dev/src/core/display/Container.js

1reaction
ivanpopelyshevcommented, Dec 28, 2017

Not a bug. Either add click event to interaction manager (renderer.plugins.interaction) directly, either use background element:

var back = new PIXI.Container();
back.hitArea = app.screen;
app.stage.addChild(back);
back.interactive = true;
back.on('click', () => {... });
Read more comments on GitHub >

github_iconTop Results From Across the Web

PIXI.Container don't have method containsPoint cause event ...
Click on stage would trigger click event. Actual Nothing triggered. Found out the reason is PIXI.Container doesn't have method containsPoint , ...
Read more >
PIXI.Container - PixiJS API Documentation
Container is a general-purpose display object that holds children. ... default behaviour of pixi 4.0-5.2 and caused many problems to users.
Read more >
pixijs/pixi.js - Gitter
Hi, I just hit Could not find a declaration file for module '@pixi/core' when trying to use it with typescript. Any list of...
Read more >
https://fgregor.com/js/pixi-5.3.3.min.js.map
n// If `Object.create(null)` is not supported we prefix the event names with ... reflex, can't be an ear\n\n // now make sure we...
Read more >
Large number of interactive objects - Performance - Pixi.js
You need custom containsPoint method on container that has all those tiles. Whether you draw with graphics, sprites or pixi-tilemap.
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