Skip to content

A feature for a PIXI.js to enable window double click event

Notifications You must be signed in to change notification settings

HusakYurii/pixi-additional-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Features for PIXI.js interactivity

Since PIXI 5 has been split into components, I added a feature which uses the same flow that interaction manager has. To use the events, copy files to your project. Then import the files in your index.js (at the top) and it should work fine.

List

  1. window double click event feature for a PIXI.js. THIS ONE SEEMS TO WORK FINE BUT NEED TO BE TESTED MORE
import "./path_to_the_file/dbclick.js";

// the usage of this one is pretty straightforward
const text = new Text("Test the dblclick", {
    fill: "#cfb9b9",
    fontSize: 30,
});

// if a user is currently on PC, it will work
text.on("dblclick", (event) => {
    console.log("dblclick event!");
    // the same event which other PIXI.js events have
    console.log(event);
});
  1. window touch event was used to create doube touch event feature for a PIXI.js. THIS ONE SHOULD BE TESTED
import "./path_to_the_file/dbtouch.js";

const config = {
    width: 300,
    height: 300,
    antialias: true,
    view: document.getElementById("canvas")
};

const app = new Application(config);
app.stage.position.set(150, 150);
const text = new Text("I am for testing!", {
    fill: "#cfb9b9",
    fontFamily: "Comic Sans MS",
    fontSize: 30,
    fontWeight: "bold"
});

// will happen if a user makes 2 touches with in the 300 ms at the same object
text.on("dbltouch", (event) => {
    console.log("dbtouch event!");
    // the same event which other PIXI.js events have
    console.log(event);

});

app.stage.addChild(text);

About

A feature for a PIXI.js to enable window double click event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published