Changeset - 97f8ae90566a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2014-08-21 23:46:55
madski@unity3d.com
graph: handle failing canvas creation

Seen randomly when PR had "No changesets" or when reloading while the changelog
+ graph was loading.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -26,12 +26,16 @@ function BranchRenderer(canvas_id, conte
 

	
 
	this.canvas = document.getElementById(canvas_id);
 
	var t = document.getElementById(content_id);
 
	
 
	if (!document.createElement("canvas").getContext)
 
		this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);
 
	if (!this.canvas) { // canvas creation did for some reason fail - fail silently
 
		this.render = function(data,canvasWidth) {};
 
		return;
 
	}
 
	this.ctx = this.canvas.getContext('2d');
 
	this.ctx.strokeStyle = 'rgb(0, 0, 0)';
 
	this.ctx.fillStyle = 'rgb(0, 0, 0)';
 
	this.cur = [0, 0];
 
	this.line_width = 2.0;
 
	this.dot_radius = 3.5;
0 comments (0 inline, 0 general)