-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bff2c02
commit 43a2224
Showing
8 changed files
with
398 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
body { | ||
margin: 0; | ||
font-family: 'Liberation Sans', sans-serif; | ||
} | ||
|
||
header { | ||
margin-bottom: 40px; | ||
padding: 30px 20px; | ||
background: linear-gradient(to left, #F0F0F0, #FFFFFF 50%); | ||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); | ||
text-align: right; | ||
} | ||
|
||
header h1 { | ||
margin: 0; | ||
color: #3D3D3D; | ||
} | ||
|
||
#content { | ||
width: 70%; | ||
max-width: 1000px; | ||
margin: 0 auto; | ||
line-height: 1.5em; | ||
font-size: 1.1em; | ||
} | ||
|
||
#container, #your-pano { | ||
width: 70%; | ||
height: 0; | ||
margin: 0 auto; | ||
} | ||
|
||
p { | ||
margin-bottom: 30px; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
color: #0096FF; | ||
} | ||
|
||
a:hover { | ||
color: #FF9600; | ||
} | ||
|
||
code { | ||
padding: 5px 10px; | ||
border-radius: 3px; | ||
background-color: #F0F0F0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Photo Sphere Viewer</title> | ||
<meta name="viewport" content="initial-scale=1.0" /> | ||
<link rel="stylesheet" href="./example1.css" /> | ||
<script src="./three.min.js"></script> | ||
<script src="./photo-sphere-viewer.js"></script> | ||
<script src="./example1.js"></script> | ||
</head> | ||
|
||
<body> | ||
<header> | ||
<h1>Example of use of Photo Sphere Viewer</h1> | ||
</header> | ||
|
||
<div id="content"> | ||
<p>This example lets you test Photo Sphere Viewer by loading a predefined panorama (the one which was already loaded by the other example). To see this panorama, just hit the link below: currently, the <code>div</code> has a height of 0 pixel but Photo Sphere Viewer will increase it to 500 pixels.</p> | ||
|
||
<div id="container"></div> | ||
|
||
<p style="text-align: center;"> | ||
<a href="#" id="go">Load the predefined panorama</a> | ||
</p> | ||
|
||
<p>Note that the panorama is here given as a relative path, but you can give to Photo Sphere Viewer an absolute one or an URL pointing to another website if this website allows CORS.</p> | ||
|
||
<p>Have you got a panorama stored on your computer? Try to read it with Photo Sphere Viewer with the following button. The code uses the FileReader API and is very simple to write (you can retrieve the source code in the <code>example1.js</code> file).</p> | ||
|
||
<div id="your-pano"></div> | ||
|
||
<form method="get" action="example1.html"> | ||
<p style="text-align: center;"> | ||
<input type="file" name="pano" id="pano" /> | ||
</p> | ||
</form> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
window.onload = function() { | ||
document.getElementById('go').addEventListener('click', loadPredefinedPanorama, false); | ||
|
||
document.getElementById('pano').addEventListener('change', upload, false); | ||
}; | ||
|
||
// Load the predefined panorama | ||
function loadPredefinedPanorama(evt) { | ||
evt.preventDefault(); | ||
|
||
var div = document.getElementById('container'); | ||
|
||
var PSV = new PhotoSphereViewer({ | ||
// Path to the panorama | ||
panorama: './sun.jpg', | ||
|
||
// Container | ||
container: div, | ||
|
||
// Deactivate the animation | ||
time_anim: false, | ||
|
||
// Display the navigation bar | ||
navbar: true, | ||
|
||
// Resize the panorama | ||
size: { | ||
width: '100%', | ||
height: '500px' | ||
} | ||
}); | ||
} | ||
|
||
// Load a panorama stored on the user's computer | ||
function upload() { | ||
// Retrieve the chosen file and create the FileReader object | ||
var file = document.getElementById('pano').files[0]; | ||
var reader = new FileReader(); | ||
|
||
reader.onload = function() { | ||
var div = document.getElementById('your-pano'); | ||
|
||
var PSV = new PhotoSphereViewer({ | ||
// Panorama, given in base 64 | ||
panorama: reader.result, | ||
|
||
// Container | ||
container: div, | ||
|
||
// Deactivate the animation | ||
time_anim: false, | ||
|
||
// Display the navigation bar | ||
navbar: true, | ||
|
||
// Resize the panorama | ||
size: { | ||
width: '100%', | ||
height: '500px' | ||
} | ||
}); | ||
}; | ||
|
||
reader.readAsDataURL(file); | ||
} |
Oops, something went wrong.