Added postprocessing options

This commit is contained in:
Luis Leiva 2016-11-27 22:08:39 +01:00
parent 0a4ff8ba75
commit f1a0b04bdf
1 changed files with 13 additions and 4 deletions

View File

@ -49,10 +49,7 @@
// Fix Chrome "bug". // Fix Chrome "bug".
this.onselectstart = function(){ return false }; this.onselectstart = function(){ return false };
} }
if (options.cssCursors) { postProcess(elem, options);
// Visually indicate whether this element is interactive or not.
elem[0].style.cursor = options.interactive ? "pointer" : "not-allowed";
}
} }
var sketch = new jSketch(this, options.graphics); var sketch = new jSketch(this, options.graphics);
// Reconfigure element data. // Reconfigure element data.
@ -88,6 +85,7 @@
return this.each(function(){ return this.each(function(){
var elem = $(this), data = elem.data(_ns); var elem = $(this), data = elem.data(_ns);
data.options = $.extend(true, {}, $.fn.sketchable.defaults, data.options, opts || {}); data.options = $.extend(true, {}, $.fn.sketchable.defaults, data.options, opts || {});
postProcess(elem);
}); });
}, },
/** /**
@ -287,6 +285,17 @@
} }
}; };
/**
* @private
*/
function postProcess(elem, options) {
if (!options) options = elem.data(_ns).options;
if (options.cssCursors) {
// Visually indicate whether this element is interactive or not.
elem[0].style.cursor = options.interactive ? "pointer" : "not-allowed";
}
};
/** /**
* @private * @private
*/ */