From bc468f9540e507e6ba557bc754e1355d9d7f4f9d Mon Sep 17 00:00:00 2001 From: fadomire Date: Tue, 27 Aug 2013 09:54:13 +0200 Subject: [PATCH] excanvas support for IE7/8 compatibility added excanvas support code from @buradleix https://github.com/buradleix/jQuery-Knob/ --- js/jquery.knob.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/js/jquery.knob.js b/js/jquery.knob.js index ae36b6b..a0b4729 100644 --- a/js/jquery.knob.js +++ b/js/jquery.knob.js @@ -150,10 +150,15 @@ (!this.o.displayInput) && this.$.hide(); - this.$c = $(''); + this.$c = $(document.createElement('canvas')).attr({ + width: this.o.width, + height: this.o.height + }); + if (typeof G_vmlCanvasManager !== 'undefined') { + G_vmlCanvasManager.initElement(this.$c[0]); + } + this.c = this.$c[0].getContext? this.$c[0].getContext('2d') : null; if (!this.c) { @@ -209,13 +214,9 @@ this._draw = function () { // canvas pre-rendering - var d = true, - c = document.createElement('canvas'); - - c.width = s.o.width * s.scale; - c.height = s.o.height * s.scale; + var d = true; - s.g = c.getContext('2d'); + s.g = s.c; s.clear(); @@ -224,8 +225,6 @@ (d !== false) && s.draw(); - s.c.drawImage(c, 0, 0); - c = null; }; this._touch = function (e) { @@ -682,4 +681,4 @@ ).parent(); }; -})(jQuery); \ No newline at end of file +})(jQuery);