Mercurial > kallithea
changeset 4812:d7420a74b98d
graph: implement retina scaling in javascript
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 08 Jul 2014 20:33:50 -0500 |
parents | 37354e1ab283 |
children | 749b5e8cead3 |
files | kallithea/public/js/graph.js |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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<data.length;i++) { var in_l = data[i][1];