ZIM js JavaScript Framework

Canvas Components, Controls and more!

Drag and Drop and Hit Tests (oh my!) in HTML 5 Canvas, JavaScript and CreateJS with ZIM js

Drag and Drop and Hit Test on HTML 5 Canvas and JavaScript and CreateJS

ZIM js provides one line Drag and Drop for the HTML 5 Canvas and CreateJS / EaselJS.  For instance:

zim.drag(circle);

You can also specify a bounding rectangle, cursor types, whether to drag items inside or not, whether you want to be able to swipe the object and whether the bounding rectangle is global or in the same parent as your object.  You can turn off dragging and dropping with zim.noDrag(circle); // or whatever.

ZIM js also provides FIVE different Hit Tests for HTML 5 Canvas.  These are:

  • zim.hitTestPoint(obj, x, y);
  • zim.hitTestReg(a, b); // object a and object b
  • zim.hitTestRect(a, b, num); // num of points on side of rect of b
  • zim.hitTestCircle(a, b, num); // num of points around circle of b
  • zim.hitTestBounds(a, b, boundshape);

ZIM js is a free open source Library of Interactive Media modules that works with CreateJS Library to code in JavaScript on the HTML 5 Canvas.

-15-

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on October 5, 2015 by in Uncategorized.

Categories

%d bloggers like this: