# HG changeset patch # User Sean Farley # Date 1404869630 18000 # Node ID d7420a74b98da68cc700d5eb33035248b8989ec5 # Parent 37354e1ab2839764f1d6b572d47bf787ecc8dcac graph: implement retina scaling in javascript diff -r 37354e1ab283 -r d7420a74b98d kallithea/public/js/graph.js --- a/kallithea/public/js/graph.js Wed Feb 11 02:40:28 2015 +0100 +++ b/kallithea/public/js/graph.js Tue Jul 08 20:33:50 2014 -0500 @@ -68,6 +68,15 @@ 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