forked from Kolyah35/minecraft-pe-0.6.1
Landscape mode on Android PWA
This commit is contained in:
@@ -48,6 +48,25 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function isAndroid() {
|
||||
return /Android/i.test(navigator.userAgent || '');
|
||||
}
|
||||
|
||||
function lockLandscapeOnAndroid() {
|
||||
if (!isAndroid()) return;
|
||||
|
||||
var orientation = screen.orientation;
|
||||
if (!orientation || typeof orientation.lock !== 'function') return;
|
||||
|
||||
orientation.lock('landscape').catch(function () {});
|
||||
}
|
||||
|
||||
lockLandscapeOnAndroid();
|
||||
window.addEventListener('pointerdown', lockLandscapeOnAndroid, { once: true });
|
||||
window.addEventListener('touchstart', lockLandscapeOnAndroid, { once: true, passive: true });
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var Module = {
|
||||
canvas: document.getElementById('canvas'),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"scope": "./",
|
||||
"display_override": ["standalone"],
|
||||
"display": "standalone",
|
||||
"orientation": "landscape",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "#000000",
|
||||
"icons": [
|
||||
|
||||
Reference in New Issue
Block a user