Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

InteractionManager

$
0
0

Question about the InteractionManager:

The following works as expected:

InteractionManager.on("pointerdown", handlePointerDown);
function handlePointerDown(e) {
    InteractionManager.off("pointerdown", handlePointerDown);
    console.log("hello", e.data.identifier);
}
console: "hello" 1

The following adds the event twice (I would have not expected that to happen with the same event/function):

InteractionManager.on("pointerdown", handlePointerDown);
InteractionManager.on("pointerdown", handlePointerDown);
function handlePointerDown(e) {
    InteractionManager.off("pointerdown", handlePointerDown);
    console.log("hello");
}
console: "hello" 1 (2)

Even with the issue above, I would have expected 'removeAllListeners' to eliminate the second call, but it does not:

InteractionManager.on("pointerdown", handlePointerDown);
InteractionManager.on("pointerdown", handlePointerDown);
function handlePointerDown(e) {
    InteractionManager.removeAllListeners();
    console.log("hello");
}
console: "hello" 1 (2)

Is this the way this stuff is supposed to work? I could certainly manage all events very explicitly...but it would be so much simpler to be able to 'removeAllListeners' when needed instead of using 'off' for every single event.

Cheers,

r o b


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>