Added a config method to change options on the fly

This commit is contained in:
Luis Leiva 2015-07-29 20:40:39 +02:00
parent 9e6bbd13a0
commit 78f257ebdc
2 changed files with 16 additions and 1 deletions

View File

@ -72,6 +72,21 @@
}
});
},
/**
* Changes config on the fly of an existing sketchable element.
* @param {Object} opts plugin configuration (see defaults).
* @return jQuery
* @namespace methods.config
* @example
* $(selector).sketchable('config', { interactive: false }); // Then:
* $(selector).sketchable('config', { interactive: true });
*/
config: function(opts) {
return this.each(function(){
var elem = $(this), data = elem.data(_ns);
data.options = $.extend(true, {}, $.fn.sketchable.defaults, opts || {});
});
},
/**
* Gets/Sets drawing data strokes sequence.
* @param {Array} arr - Multidimensional array of [x,y,time,status] tuples; status = 0 (pen down) or 1 (pen up).

File diff suppressed because one or more lines are too long