Giter Club home page Giter Club logo

pixi.draggable's Introduction

PIXI.draggable

The easiest way to get drag & drop done in PIXI.js!

Demo: http://mokgames.com/draggable/

Bag & Skillbar Demo! http://mokgames.com/draggable/demo2.html

How to use

Simply load the pixi.draggable.js file after your pixi.js file.

<script src="pixi.js"></script>
<script src="pixi.draggable.js"></script>

Creating a draggable sprite

var sprite = new PIXI.Sprite(texture);
stage.addChild(sprite);

sprite.draggable();

Only draggable along the x-axis

var sprite = new PIXI.Sprite(texture);
stage.addChild(sprite);

sprite.draggable({ axis: 'x' });

Full list of drag options

{
  distance: 1,
  axis: null,
  containment: null,
  cursor: 'inherit',
  cursorAt: null,
  grid: false,
  handle: null,
  cancel: null,
  helper: 'original',
  alpha: 1,
  revert: false,
  revertDuration: 500,
  label: null,
  snap: null,
  snapMode: 'both',
  snapSort: false,
  snapTolerance: 20,
  disabled: false,

  // special drag events
  drag: null,
  start: null,
  stop: null,

  // regular mouse // tap events
  mousedown: null,
  mousemove: null,
  mouseup: null,
  mouseupoutside: null
}

Full list of drop options

{
  label: null,
  drop: null,
  accept: true,
  greedy: false,
  disabled: false,
  tolerance: 'intersect'
}

A tutorial and the sourcecode to achieve all the effects on the demo page will soon be online!

pixi.draggable's People

Contributors

sebastiannette avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pixi.draggable's Issues

Touch support

Does it support touch devices yet? The demo doesn't work on touch devices for me.

install via npm

i would like to be able to install the drag function via npm, thanks

Uncaught TypeError

I am getting the following error:

Uncaught TypeError: Cannot read property 'prototype' of undefined
pixi.draggable.min.js:75 (anonymous function)

Pixi.js 3.0.3 - ✰ WebGL ✰

This is on Chromium Version 41.0.2272.76 Ubuntu 14.04 (64-bit)

Thanks!

rotation

this is much more a request rather than a issue.
So my request is to add a rotation to the lib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.