diff options
author | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 21:45:40 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 21:45:40 +0000 |
commit | 5ebb411aedc86b634719c83c646211b9f0c9d5c3 (patch) | |
tree | f53cabbe431c039c1f03a71b460502cb691efa17 /o3d/samples/o3djs | |
parent | 4cbc21122ce5a698c2104858dc723d4ccb35f1f0 (diff) | |
download | chromium_src-5ebb411aedc86b634719c83c646211b9f0c9d5c3.zip chromium_src-5ebb411aedc86b634719c83c646211b9f0c9d5c3.tar.gz chromium_src-5ebb411aedc86b634719c83c646211b9f0c9d5c3.tar.bz2 |
Fixed samples to work with resizing code introduced yesterday. Now the
setup of the containing div is identical to that in the plugin version
of O3D. Fixed createClients to only call the initialization callback
once the client's initial size has been set. Fixed bug in texture wrap
mode setup which was breaking the bump map in helloworld.html.
BUG=none
TEST=ran all o3d-webgl samples
TBR=petersont
Review URL: http://codereview.chromium.org/1687019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45866 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs')
-rw-r--r-- | o3d/samples/o3djs/webgl.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/o3d/samples/o3djs/webgl.js b/o3d/samples/o3djs/webgl.js index 9687af6..d9c53f3 100644 --- a/o3d/samples/o3djs/webgl.js +++ b/o3d/samples/o3djs/webgl.js @@ -80,7 +80,19 @@ o3djs.webgl.makeClients = function(callback, clientElements.push(objElem); } - callback(clientElements); + // Wait for the client elements to be fully initialized. This + // involves waiting for the page to fully layout and the initial + // resize event to be processed. + var clearId = window.setInterval(function() { + for (var cc = 0; cc < clientElements.length; ++cc) { + var element = clientElements[cc]; + if (!element.sizeInitialized_) { + return; + } + } + window.clearInterval(clearId); + callback(clientElements); + }); }; @@ -154,6 +166,7 @@ o3djs.webgl.createClient = function(element, opt_features, opt_debug) { var height = Math.max(1, canvas.clientHeight); canvas.width = width; canvas.height = height; + canvas.sizeInitialized_ = true; }; window.addEventListener('resize', resizeHandler, false); setTimeout(resizeHandler, 0); |