1. douglaz
  2. jqplot-douglaz

Commits

cleonello  committed d14a4c0

improved canvas text support detection for canvas text and rotated text rendering.

  • Participants
  • Parent commits e5b0001
  • Branches default

Comments (0)

Files changed (1)

File src/plugins/jqplot.canvasAxisTickRenderer.js

View file
         }
         
         if (this.enableFontSupport) {
-            if ($.browser.safari) {
-                var p = $.browser.version.split('.');
-                for (var i=0; i<p.length; i++) { p[i] = Number(p[i]); }
-                if (p[0] > 528 || (p[0] == 528 && p[1] >= 16)) {
-                    this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts); 
-                }
+            
+            function support_canvas_text() {
+                return !!(document.createElement('canvas').getContext && typeof document.createElement('canvas').getContext('2d').fillText == 'function');
+            };
+            
+            if (support_canvas_text()) {
+                this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
             }
-            else if ($.browser.mozilla) {
-                var p = $.browser.version.split(".");
-                if (p[0] > 1 || (p[0] == 1 &&  p[1] >= 9 && p[2] > 0) ) {
-                    this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
-                }
-                else {
-                    this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
-                }
-            }
-            
-            // TODO: test and enable this
-            // else if ($.browser.msie) {
-            //     this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts); 
-            // }
             
             else {
                 this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);