Skip to content

Commit

Permalink
Fix iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
curiousdannii committed May 24, 2024
1 parent a612892 commit a708e9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arthur.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Arthur: The Quest for Excalibur</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,interactive-widget=resizes-content">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0">
<link rel="stylesheet" href="styles.css">
</head>
<body>
Expand Down
16 changes: 9 additions & 7 deletions interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ const textinput_elem = document.getElementById('textinput')
// Prevent iOS from zooming in when focusing input, but allow Android to still pinch zoom
// As they handle the maximum-scale viewport meta option differently, we will conditionally add it only in iOS
// Idea from https://stackoverflow.com/a/62750441/2854284
if (/iPhone OS/i.test(navigator.userAgent)) {
document.head.querySelector('meta[name="viewport"]').content = 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1'
}
/* document.addEventListener('DOMContentLoaded', (event) => {
if (/iPhone OS/i.test(navigator.userAgent)) {
document.head.querySelector('meta[name="viewport"]').content = 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1'
}
}) */

visualViewport.addEventListener('resize', () => {
/* visualViewport.addEventListener('resize', () => {
const height = visualViewport.height
document.documentElement.style.height = `${height}px`
// Safari might have scrolled weirdly, so try to put it right
window.scrollTo(0, 0)
setTimeout(() => window.scrollTo(0, 0), 500)
})
}) */

// Mobile input event handlers
canvas_elem.addEventListener('touchstart', ev => {
Expand Down Expand Up @@ -74,7 +76,7 @@ textinput_elem.addEventListener('keyup', ev => {
})

// Arthur buttons
const arthurmodes = document.getElementById('arthurmodes')
/*const arthurmodes = document.getElementById('arthurmodes')
if (arthurmodes) {
arthurmodes.addEventListener('click', ev => {
let target = ev.target
Expand All @@ -86,7 +88,7 @@ if (arthurmodes) {
}
textinput_elem.focus()
})
}
}*/

// Send a fake keydown/keyup
const named_codes = {
Expand Down

0 comments on commit a708e9d

Please sign in to comment.