Changeset - 2346f7b1b82a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-02-19 00:00:40
madski@unity3d.com
graph: work around Firefox OS X limit of canvas size 32k when scaling
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -65,14 +65,15 @@ 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) {
 
		// 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";
 
			this.canvas.style.height = content.clientHeight + "px";
 
			this.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
 
		}
0 comments (0 inline, 0 general)