Skip to content

Commit

Permalink
Fixed a bug which prevented custom jCanvas methods from being added a…
Browse files Browse the repository at this point in the history
…s layers

Also added a disableDrag property for easier toggling of draggable
states.
  • Loading branch information
Caleb Evans committed Sep 14, 2012
1 parent 31cab83 commit b47e419
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 46 deletions.
21 changes: 21 additions & 0 deletions README.md
@@ -0,0 +1,21 @@
# [jCanvas](http://calebevans.me/projects/jcanvas/)
*Copyright 2012, Caleb Evans*
*Licensed under the MIT license*

jCanvas is a JavaScript library that makes the HTML5 canvas easy to work with.

## [Download](http://calebevans.me/projects/jcanvas/downloads.php)

jCanvas requires jQuery 1.4 or newer.

## [Documentation](http://calebevans.me/projects/jcanvas/downloads.php)

Please read the documentation before emailing me any questions you may have.

## [Support](http://calebevans.me/projects/jcanvas/support.php)

Frequently asked questions, license questions, and more.

## [License](https://github.com/caleb531/jcanvas/blob/master/license.txt)

You've been warned...
8 changes: 5 additions & 3 deletions jcanvas.js
Expand Up @@ -51,7 +51,8 @@ defaults = {
compositing: 'source-over',
cornerRadius: 0,
cropFromCenter: TRUE,
draggable: false,
draggable: FALSE,
disableDrag: FALSE,
each: NULL,
end: 360,
fillStyle: 'transparent',
Expand Down Expand Up @@ -246,14 +247,15 @@ jCanvas.extend = function(plugin) {

// Create plugin
if (plugin.name) {
$.fn[plugin.name] = function(args) {
$.fn[plugin.name] = function self(args) {
var $elems = this, elem, e, ctx,
params = merge(new Prefs(), args);

for (e=0; e<$elems.length; e+=1) {
elem = $elems[e];
ctx = getContext(elem);
if (ctx) {
addLayer($elems[e], args, self);
setGlobalProps(ctx, params);
plugin.fn.call(elem, ctx, params);
}
Expand Down Expand Up @@ -556,7 +558,7 @@ $.fn.drawLayers = function(resetFire) {
}

// Use the mousedown event to start drag
if (layer.draggable && eventType === 'mousedown') {
if (layer.draggable && !layer.disableDrag && eventType === 'mousedown') {

// Being layer to front when drag starts (if chosen)
if (layer.bringToFront) {
Expand Down

0 comments on commit b47e419

Please sign in to comment.