Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: samples/o3djs/webgl.js

Issue 1687019: Fixed samples to work with resizing code introduced yesterday. Now the... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« samples/o3d-webgl/pack.js ('K') | « samples/o3d-webgl/texture.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/o3djs/webgl.js
===================================================================
--- samples/o3djs/webgl.js (revision 45777)
+++ samples/o3djs/webgl.js (working copy)
@@ -80,7 +80,19 @@
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 @@
var height = Math.max(1, canvas.clientHeight);
canvas.width = width;
canvas.height = height;
+ canvas.sizeInitialized_ = true;
};
window.addEventListener('resize', resizeHandler, false);
setTimeout(resizeHandler, 0);
« samples/o3d-webgl/pack.js ('K') | « samples/o3d-webgl/texture.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698