changeset 4826:2346f7b1b82a

graph: work around Firefox OS X limit of canvas size 32k when scaling
author Mads Kiilerich <madski@unity3d.com>
date Thu, 19 Feb 2015 00:00:40 +0100
parents a0443f20a5ec
children 8d76245daefa
files kallithea/public/js/graph.js
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/js/graph.js	Wed Feb 11 21:10:43 2015 +0100
+++ b/kallithea/public/js/graph.js	Thu Feb 19 00:00:40 2015 +0100
@@ -68,8 +68,9 @@
 		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) {
+		// HiDPI version needs to be scaled by 2x then halved via css
+		// Note: Firefox on OS X fails scaling if the canvas height is more than 32k
+		if (window.devicePixelRatio && content.clientHeight * window.devicePixelRatio < 32768) {
 			this.canvas.setAttribute('width', canvasWidth * window.devicePixelRatio);
 			this.canvas.setAttribute('height', content.clientHeight * window.devicePixelRatio);
 			this.canvas.style.width = canvasWidth + "px";