Skip to content
This repository has been archived by the owner on Dec 29, 2021. It is now read-only.
/ unipointer Public archive

☝️ Do one thing with one pointer

Notifications You must be signed in to change notification settings

metafizzy/unipointer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

Unipointer code has been merged into Unidragger v3. Unipointer will no longer be maintained as its own package.

Unipointer

Base class for doing one thing with pointer event

Used with Unidragger

Install

Bower: bower install unipointer

npm: npm install unipointer

Usage

// create new class
function PointerFun( elem ) {
  this.element = elem;
  // binds mousedown/touchstart/pointerdown event
  this._bindStartEvent( this.element, true );
}
// inherit Unipointer
PointerFun.prototype = new Unipointer();

// overwrite public pointer methods
PointerFun.prototype.pointerDown = function( event, pointer ) {
  console.log('pointer down');
};

PointerFun.prototype.pointerMove = function( event, pointer ) {
  console.log('pointer move');
};

PointerFun.prototype.pointerUp = function( event, pointer ) {
  console.log('pointer up');
};

PointerFun.prototype.pointerCancel = function( event, pointer ) {
  console.log('pointer cancel');
};

// triggered on pointerUp and pointerCancel 
PointerFun.prototype.pointerDone = function( event, pointer ) {
  console.log('pointer done');
};

MIT license

By Metafizzy

About

☝️ Do one thing with one pointer

Resources

Stars

Watchers

Forks

Packages

No packages published