-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
210 lines (174 loc) · 7.35 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.min.css"/>
<link href="https://fonts.googleapis.com/css2?family=Delius&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/three/build/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/uevent@2/browser.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<style>
/* the viewer container must have a defined size */
#viewer {
height: auto;
width: calc(100vw - 500px);
margin:auto;
border: solid black 2px;
}
.navbar-brand {
font-size:30px;
font-weight:bold;
font-family: Delius;
}
.la-logo {
width:250px;
height: auto;
position:absolute;
right: 10px;
bottom: 10px;
z-index:1000;
}
#the-file-input {
font-style: italic;
font-weight: normal;
//color: gray !important;
opacity: 1;
}
.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {
color: #eee;
background-color: transparent !important;
border: none !important;
}
.nav-tabs .nav-link:focus, .nav-tabs .nav-link:hover {
border: none !important;
}
.nav-tabs .nav-link {
border: none !important;
}
a {
color: #aaa;
}
a:hover {
color: white;
text-decoration: none;
}
.nav-tabs {
border-bottom: none !important;
}
h4 {
color:#343a40;
}
.form-control:focus {
border: solid gray 1px !important;
outline: none !important;
box-shadow:none !important;
}
.flex-grow {
flex: 1 0 auto;
}
</style>
</head>
<body>
<img class="la-logo" src="images/logo.png" />
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-top:0px; padding-left: 30px; height:10px; background:transparent;">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
</div>
</nav>
<div class="tab-content" style="margin-top:40px">
<div class="tab-pane active" id="view" role="tabpanel" aria-labelledby="view-tab">
<div class="container">
<div class="row">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="min-width:300px !important">
Iphone 12 Pro Max (landscape)
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="resDropdown">
<a class="dropdown-item">Iphone 12 Pro Max (landscape)</a>
<a class="dropdown-item">Iphone 12 Pro Max (portrait)</a>
<a class="dropdown-item">Ipad Pro (landscape)</a>
<a class="dropdown-item">Ipad Pro (portrait)</a>
</div>
</div>
<div class="flex-grow">
<div class="input-group" style="width:100%;margin-left:auto">
<input type="text" class="form-control" id="file-text"
placeholder="Choose an equirectangular image." style="outline:none !important">
<button class="btn btn-secondary" type="button" id="browse-button">Browse</button>
</div>
</div>
</div>
<input type="file" id="file-input" style="visibility:hidden !important">
</div>
</div>
</div>
<div id="viewer"></div>
<div style="height:10px; bottom:0px; width:100vw; position:absolute;background:#343a40"></div>
<script>
var resolutions = {
"Iphone 12 Pro Max (portrait)": { width: 1284, height: 2778 },
"Iphone 12 Pro Max (landscape)": { width: 2778, height: 1284 },
"Ipad Pro (landscape)": { width: 2732, height: 2048 },
"Ipad Pro (portrait)": { width: 2048, height: 2732 },
}
$('#browse-button').click(function(){
$('#file-input').click();
});
var viewer = new PhotoSphereViewer.Viewer({
container: document.querySelector('#viewer'),
panorama: 'images/default.jpg'
});
var fileInput = document.getElementById("file-input");
$('.dropdown-menu a').click(function () {
var selection = $(this).text();
$('#dropdownMenuButton').text(selection);
resizeViewer(resolutions[selection]);
});
$(window).resize(function () {
var selection = $('#dropdownMenuButton').text().trim();
var res = resolutions[selection];
if (res)
resizeViewer(resolutions[$('#dropdownMenuButton').text().trim()])
})
$(document).ready(function () {
var selection = $('#dropdownMenuButton').text().trim();
var res = resolutions[selection];
if (res)
resizeViewer(resolutions[$('#dropdownMenuButton').text().trim()])
});
function resizeViewer(res) {
if (!res) return;
var selection = $(this).text();
var winx = $(window).width();
var winy = $(window).height();
var aspect = res.width / res.height;
var height = winy - 170;
var width = height * aspect;
$('#viewer').css("width", width);
$('#viewer').css("height", height);
viewer.resize({height, width});
}
$('#file-input').on('change', function () {
var file = fileInput.files.item(0);
var fn = file.name;
var reader = new FileReader();
reader.onload = function (event) {
the_url = event.target.result;
viewer.setPanorama(the_url);
}
reader.readAsDataURL(file);
$('#file-text').val(fn)
});
resizeViewer(resolutions[$('#dropdownMenuButton').text()])
</script>
</body>
</html>