Retain old configuration when calling the 'configure' method

This commit is contained in:
Luis Leiva 2016-11-27 21:32:46 +01:00
parent a02efe2742
commit f43ee62991
1 changed files with 2 additions and 1 deletions

View File

@ -76,6 +76,7 @@
},
/**
* Changes config on the fly of an existing sketchable element.
* Previous options are retained. To completely reconfigure them just use the reset method.
* @param {Object} opts - Plugin configuration (see defaults).
* @return jQuery
* @namespace methods.config
@ -86,7 +87,7 @@
config: function(opts) {
return this.each(function(){
var elem = $(this), data = elem.data(_ns);
data.options = $.extend(true, {}, $.fn.sketchable.defaults, opts || {});
data.options = $.extend(true, opts || {}, $.fn.sketchable.defaults, data.options);
});
},
/**