Browse Source

Examples: Workaround for Safari/iOS8 bug.

Mr.doob 11 years ago
parent
commit
d505e4d1f9
2 changed files with 12 additions and 5 deletions
  1. 12 2
      examples/index.html
  2. 0 3
      examples/webgl_buffergeometry_particles.html

+ 12 - 2
examples/index.html

@@ -1,8 +1,8 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<meta charset="utf-8">
 		<title>three.js - examples</title>
 		<title>three.js - examples</title>
+		<meta charset="utf-8">
 		<style>
 		<style>
 
 
 			@font-face {
 			@font-face {
@@ -67,7 +67,6 @@
 			#viewer {
 			#viewer {
 				position: absolute;
 				position: absolute;
 				left: 310px;
 				left: 310px;
-				width: -webkit-calc(100% - 310px); /* Safari */
 				width: calc(100% - 310px);
 				width: calc(100% - 310px);
 				height: 100%;
 				height: 100%;
 				border: 0px;
 				border: 0px;
@@ -355,6 +354,17 @@
 		var list = document.getElementById( 'list' );
 		var list = document.getElementById( 'list' );
 		var viewer = document.getElementById( 'viewer' );
 		var viewer = document.getElementById( 'viewer' );
 
 
+		if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
+
+			viewer.addEventListener( 'load', function ( event ) {
+
+				viewer.contentWindow.innerWidth -= 10;
+				viewer.contentWindow.innerHeight -= 2;
+
+			} );
+
+		}
+
 		var container = document.createElement( 'div' );
 		var container = document.createElement( 'div' );
 		list.appendChild( container );
 		list.appendChild( container );
 
 

+ 0 - 3
examples/webgl_buffergeometry_particles.html

@@ -137,9 +137,6 @@
 
 
 			function onWindowResize() {
 			function onWindowResize() {
 
 
-				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
-
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
 				camera.updateProjectionMatrix();