mirror of
https://github.com/PrismarineJS/prismarine-web-client.git
synced 2025-08-28 21:28:44 -04:00
[pick pr] [wip] mouse raw input. Doesn't work for now for some reason :(
This commit is contained in:
parent
a67d05ae99
commit
ddf5315108
3 changed files with 30 additions and 3 deletions
18
index.js
18
index.js
|
@ -310,9 +310,25 @@ async function connect (options) {
|
||||||
lastTouch = undefined
|
lastTouch = undefined
|
||||||
}, { passive: false })
|
}, { passive: false })
|
||||||
|
|
||||||
renderer.domElement.requestPointerLock = renderer.domElement.requestPointerLock ||
|
const requestPointerLock = renderer.domElement.requestPointerLock ||
|
||||||
renderer.domElement.mozRequestPointerLock ||
|
renderer.domElement.mozRequestPointerLock ||
|
||||||
renderer.domElement.webkitRequestPointerLock
|
renderer.domElement.webkitRequestPointerLock
|
||||||
|
renderer.domElement.requestPointerLock = async () => {
|
||||||
|
// request full keyboard access
|
||||||
|
// await renderer.domElement.requestFullscreen()
|
||||||
|
// // navigator.keyboard.lock(['KeyW'])
|
||||||
|
// const promise = requestPointerLock.apply(renderer.domElement, {
|
||||||
|
// unadjustedMovement: window.localStorage.getItem('mouseRawInput') === 'true'
|
||||||
|
// });
|
||||||
|
// promise?.catch((error) => {
|
||||||
|
// if (error.name === "NotSupportedError") {
|
||||||
|
// // Some platforms may not support unadjusted movement, request again a regular pointer lock.
|
||||||
|
// requestPointerLock.apply(renderer.domElement)
|
||||||
|
// } else {
|
||||||
|
// console.error(error)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
document.addEventListener('mousedown', (e) => {
|
document.addEventListener('mousedown', (e) => {
|
||||||
if (!chat.inChat && !gameMenu.inMenu) {
|
if (!chat.inChat && !gameMenu.inMenu) {
|
||||||
renderer.domElement.requestPointerLock()
|
renderer.domElement.requestPointerLock()
|
||||||
|
|
|
@ -63,6 +63,7 @@ class OptionsScreen extends LitElement {
|
||||||
this.fov = getValue('fov', 75, (v) => Number(v))
|
this.fov = getValue('fov', 75, (v) => Number(v))
|
||||||
this.guiScale = getValue('guiScale', 3, (v) => Number(v))
|
this.guiScale = getValue('guiScale', 3, (v) => Number(v))
|
||||||
this.forceMobileControls = getValue('forceMobileControls', false, (v) => v === 'true')
|
this.forceMobileControls = getValue('forceMobileControls', false, (v) => v === 'true')
|
||||||
|
this.mouseRawInput = getValue('mouseRawInput', false, (v) => v === 'true')
|
||||||
|
|
||||||
document.documentElement.style.setProperty('--chatScale', `${this.chatScale / 100}`)
|
document.documentElement.style.setProperty('--chatScale', `${this.chatScale / 100}`)
|
||||||
document.documentElement.style.setProperty('--chatWidth', `${this.chatWidth}px`)
|
document.documentElement.style.setProperty('--chatWidth', `${this.chatWidth}px`)
|
||||||
|
@ -134,7 +135,7 @@ class OptionsScreen extends LitElement {
|
||||||
}}></pmui-slider>
|
}}></pmui-slider>
|
||||||
</div>
|
</div>
|
||||||
`}
|
`}
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<pmui-button pmui-width="150px" pmui-label=${'Force Mobile Controls: ' + (this.forceMobileControls ? 'ON' : 'OFF')} @pmui-click=${() => {
|
<pmui-button pmui-width="150px" pmui-label=${'Force Mobile Controls: ' + (this.forceMobileControls ? 'ON' : 'OFF')} @pmui-click=${() => {
|
||||||
this.forceMobileControls = !this.forceMobileControls
|
this.forceMobileControls = !this.forceMobileControls
|
||||||
|
@ -149,6 +150,15 @@ class OptionsScreen extends LitElement {
|
||||||
}></pmui-button>
|
}></pmui-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
<pmui-button pmui-width="150px" pmui-label=${'Mouse Raw Input: ' + (this.mouseRawInput ? 'ON' : 'OFF')} title="Wether to disable any mouse acceleration (MC does it by default)" @pmui-click=${() => {
|
||||||
|
this.mouseRawInput = !this.mouseRawInput
|
||||||
|
window.localStorage.setItem('mouseRawInput', `${this.mouseRawInput}`)
|
||||||
|
this.requestUpdate()
|
||||||
|
}
|
||||||
|
}></pmui-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<pmui-button pmui-width="200px" pmui-label="Done" @pmui-click=${() => displayScreen(this, document.getElementById(this.isInsideWorld ? 'pause-screen' : 'title-screen'))}></pmui-button>
|
<pmui-button pmui-width="200px" pmui-label="Done" @pmui-click=${() => displayScreen(this, document.getElementById(this.isInsideWorld ? 'pause-screen' : 'title-screen'))}></pmui-button>
|
||||||
</main>
|
</main>
|
||||||
`
|
`
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
html {
|
html {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
touch-action: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dirt-bg {
|
.dirt-bg {
|
||||||
|
@ -117,4 +118,4 @@ canvas {
|
||||||
width: calc(100% / 1);
|
width: calc(100% / 1);
|
||||||
height: calc(100% / 1);
|
height: calc(100% / 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue