0.6.0 • Published 6 years ago

pixi-hammer v0.6.0

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

pixi-hammer

Connect Hammer.js with PixiJS.

Allow us to use Hammer.js gesture recognizer with PixiJS instance.

Install

npm install pixi-hammer

Usage

var PIXI = require('pixi.js');
var Connector = require('pixi-hammer');

var app = new PIXI.Application(320, 400);
// initialize the Connector
var c = new Connector(app);

// assume we have a PIXI instance
var rect = new PIXI.Graphics();
rect.beginFill(0x000000);
rect.drawRect(100, 100, 100, 100);
app.stage.addChild(rect);

// listen hammer.js event from that instance
c.listen(rect, 'pinch', function(e) {
  console.log('pinching on the rect!');
});

How it works

Instead of traverse whole PIXI scene graph, this connector cache listeners to its own stack and only check the instance itself and up to the root.

TODO

  • examples for stopPropagation etc

License

MIT

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago