mercredi 20 mai 2015

Trigger tool event on Paper.js

My app is using Paper.js as a framework for drawing elements, and I am currently coding some tests.

I need to trigger tool events manually, but I'm getting a 'emit is not a function' error.

I'm doing it like this:

tool.emit('mousedown', {
  point:  new Point(5, 5)
});

What's wrong with my code? According to Paper.js documentation:

emit(type, event) Emit an event on the tool.

Parameters: type: String('mousedown'|'mouseup'|'mousedrag'|'mousemove'|'keydown'|'keyup') — the event type event: Object — an object literal containing properties describing the event Returns: Boolean — true if the event had listeners, false otherwise

If I debug my code, tool is a Tool object, but emit doesn't exist.

Aucun commentaire:

Enregistrer un commentaire