Skip to content

Commit 43ce98a

Browse files
committed
Merge pull request aterrien#110 from fadomire/master
excanvas support for IE7/8 compatibility
2 parents adf9332 + bc468f9 commit 43ce98a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

js/jquery.knob.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,15 @@
150150

151151
(!this.o.displayInput) && this.$.hide();
152152

153-
this.$c = $('<canvas width="' +
154-
this.o.width + 'px" height="' +
155-
this.o.height + 'px"></canvas>');
153+
this.$c = $(document.createElement('canvas')).attr({
154+
width: this.o.width,
155+
height: this.o.height
156+
});
156157

158+
if (typeof G_vmlCanvasManager !== 'undefined') {
159+
G_vmlCanvasManager.initElement(this.$c[0]);
160+
}
161+
157162
this.c = this.$c[0].getContext? this.$c[0].getContext('2d') : null;
158163

159164
if (!this.c) {
@@ -209,13 +214,9 @@
209214
this._draw = function () {
210215

211216
// canvas pre-rendering
212-
var d = true,
213-
c = document.createElement('canvas');
214-
215-
c.width = s.o.width * s.scale;
216-
c.height = s.o.height * s.scale;
217+
var d = true;
217218

218-
s.g = c.getContext('2d');
219+
s.g = s.c;
219220

220221
s.clear();
221222

@@ -224,8 +225,6 @@
224225

225226
(d !== false) && s.draw();
226227

227-
s.c.drawImage(c, 0, 0);
228-
c = null;
229228
};
230229

231230
this._touch = function (e) {
@@ -682,4 +681,4 @@
682681
).parent();
683682
};
684683

685-
})(jQuery);
684+
})(jQuery);

0 commit comments

Comments
 (0)