Changeset - d7420a74b98d
[Not reviewed]
default
0 1 0
Sean Farley - 11 years ago 2014-07-09 03:33:50
sean.michael.farley@gmail.com
graph: implement retina scaling in javascript
1 file changed with 9 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -65,12 +65,21 @@ function BranchRenderer(canvas_id, conte
 
	this.render = function(data,canvasWidth) {
 
		var idx = 1;
 

	
 
		this.canvas.setAttribute('width',canvasWidth);
 
		this.canvas.setAttribute('height',content.clientHeight);
 

	
 
		// retina version needs to be scaled by 2x then halved via css
 
		if (window.devicePixelRatio) {
 
			this.canvas.setAttribute('width', canvasWidth * window.devicePixelRatio);
 
			this.canvas.setAttribute('height', content.clientHeight * window.devicePixelRatio);
 
			this.canvas.style.width = canvasWidth + "px";
 
			this.canvas.style.height = content.clientHeight + "px";
 
			this.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
 
		}
 

	
 
		var lineCount = 1;
 
		for (var i=0;i<data.length;i++) {
 
			var in_l = data[i][1];
 
			for (var j in in_l) {
 
				var m = in_l[j][0];
 
				if (m > lineCount)
0 comments (0 inline, 0 general)