Transmit mouse events from pixi.js stage to other canvas.
pixijs-mouse-event-transmitter depend on pixi.js
npm install pixi.js --save-dev
and
npm install @masatomakino/pixijs-mouse-event-transmitter --save-dev
pixijs-mouse-event-transmitter is composed of ES modules and TypeScript d.ts files.
At first, import classes.
import { MouseEventTransmitter } from "@masatomakino/pixijs-mouse-event-transmitter";
const transmitter = new MouseEventTransmitter({
transmitTarget: canvas, // transmitter target ( dom element )
app: app, // app instance of pixi.js
});
canvas.addEventListener("pointermove", (e) => {
console.log(e);
});