Comparing version 3.0.4 to 3.0.5
@@ -60,2 +60,5 @@ /** @module gl-util/context */ | ||
o.canvas = document.createElement('canvas') | ||
o.canvas.style.position = 'absolute' | ||
o.canvas.style.top = 0 | ||
o.canvas.style.left = 0 | ||
o.container.appendChild(o.canvas) | ||
@@ -85,3 +88,7 @@ resize(o) | ||
if (o.container) { | ||
if (o.container != document.body) { | ||
if (o.container == document.body) { | ||
if (!document.body.style.width) o.canvas.width = o.width || (o.pixelRatio * window.innerWidth) | ||
if (!document.body.style.height) o.canvas.height = o.height || (o.pixelRatio * window.innerHeight) | ||
} | ||
else { | ||
var bounds = o.container.getBoundingClientRect() | ||
@@ -91,6 +98,2 @@ o.canvas.width = o.width || (bounds.right - bounds.left) | ||
} | ||
else { | ||
if (!document.body.style.width) o.canvas.width = o.pixelRatio * window.innerWidth | ||
if (!document.body.style.height) o.canvas.height = o.pixelRatio * window.innerHeight | ||
} | ||
} | ||
@@ -97,0 +100,0 @@ } |
{ | ||
"name": "gl-util", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "Set of practical webgl utils", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
require('./context') |
30368
735