From f1a0b04bdff40b31bfacf92c3ac315343978e2aa Mon Sep 17 00:00:00 2001 From: Luis Leiva Date: Sun, 27 Nov 2016 22:08:39 +0100 Subject: [PATCH] Added postprocessing options --- jquery.sketchable.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/jquery.sketchable.js b/jquery.sketchable.js index 3bc2d0a..a2e9eb9 100644 --- a/jquery.sketchable.js +++ b/jquery.sketchable.js @@ -49,10 +49,7 @@ // Fix Chrome "bug". this.onselectstart = function(){ return false }; } - if (options.cssCursors) { - // Visually indicate whether this element is interactive or not. - elem[0].style.cursor = options.interactive ? "pointer" : "not-allowed"; - } + postProcess(elem, options); } var sketch = new jSketch(this, options.graphics); // Reconfigure element data. @@ -88,6 +85,7 @@ return this.each(function(){ var elem = $(this), data = elem.data(_ns); 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 */