forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add screen edges debug component (#edges in url)
fix: provide possible fix for rare issue when mobile control elements were going outside of the screen on ios
- Loading branch information
Showing
5 changed files
with
77 additions
and
3 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,55 @@ | ||
import { useState } from 'react' | ||
import { useIsHashActive } from './simpleHooks' | ||
|
||
export default () => { | ||
const MODES_COUNT = 4 | ||
const [mode, setMode] = useState(0) | ||
const isHashActive = useIsHashActive('#edges') | ||
|
||
if (!isHashActive) return null | ||
|
||
const styles: React.CSSProperties = { | ||
display: 'flex', | ||
fontSize: 18, | ||
zIndex: 10_000, | ||
background: 'rgba(0, 0, 255, 0.5)', | ||
border: '2px solid red', | ||
whiteSpace: 'pre', | ||
} | ||
let text = '' | ||
if (mode === 0) { | ||
styles.position = 'fixed' | ||
styles.inset = 0 | ||
styles.height = '100%' | ||
text = 'inset 0 fixed 100% height' | ||
} | ||
if (mode === 1) { | ||
styles.position = 'fixed' | ||
styles.inset = 0 | ||
text = 'inset 0 fixed' | ||
} | ||
if (mode === 2) { | ||
styles.position = 'absolute' | ||
styles.inset = 0 | ||
text = 'inset 0 absolute' | ||
} | ||
if (mode === 3) { | ||
styles.position = 'fixed' | ||
styles.top = 0 | ||
styles.left = 0 | ||
styles.right = 0 | ||
styles.height = '100dvh' | ||
text = 'top 0 fixed 100dvh' | ||
} | ||
|
||
return <div | ||
style={styles} | ||
onClick={() => { | ||
setMode((mode + 1) % MODES_COUNT) | ||
}} | ||
> | ||
{mode}: {text}{'\n'} | ||
inner: {window.innerWidth}x{window.innerHeight}{'\n'} | ||
outer: {window.outerWidth}x{window.outerHeight}{'\n'} | ||
</div> | ||
} |
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
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