const { LitElement, html, css } = require('lit') const { commonCss, displayScreen, isMobile } = require('./components/common') class OptionsScreen extends LitElement { static get styles () { return css` ${commonCss} .title { top: 4px; } main { display: flex; flex-direction: column; position: absolute; top: calc(100% / 6 - 6px); left: 50%; width: 310px; gap: 4px 0; place-items: center; place-content: center; transform: translate(-50%); } .wrapper { display: flex; flex-direction: row; width: 100%; gap: 0 10px; height: 20px; } ` } static get properties () { return { isInsideWorld: { type: Boolean }, mouseSensitivityX: { type: Number }, mouseSensitivityY: { type: Number }, chatWidth: { type: Number }, chatHeight: { type: Number }, chatScale: { type: Number }, sound: { type: Number }, renderDistance: { type: Number }, fov: { type: Number }, guiScale: { type: Number } } } constructor () { super() this.isInsideWorld = false const getValue = (item, defaultValue, convertFn) => window.localStorage.getItem(item) ? convertFn(window.localStorage.getItem(item)) : defaultValue this.mouseSensitivityX = getValue('mouseSensX', 50, (v) => Math.floor(Number(v) * 10000)) this.mouseSensitivityY = getValue('mouseSensY', 50, (v) => Math.floor(Number(v) * 10000)) this.chatWidth = getValue('chatWidth', 320, (v) => Number(v)) this.chatHeight = getValue('chatHeight', 180, (v) => Number(v)) this.chatScale = getValue('chatScale', 100, (v) => Number(v)) this.sound = getValue('sound', 50, (v) => Number(v)) this.renderDistance = getValue('renderDistance', 6, (v) => Number(v)) this.fov = getValue('fov', 75, (v) => Number(v)) this.guiScale = getValue('guiScale', 3, (v) => Number(v)) this.forceMobileControls = getValue('forceMobileControls', false, (v) => v === 'true') document.documentElement.style.setProperty('--chatScale', `${this.chatScale / 100}`) document.documentElement.style.setProperty('--chatWidth', `${this.chatWidth}px`) document.documentElement.style.setProperty('--chatHeight', `${this.chatHeight}px`) document.documentElement.style.setProperty('--guiScale', `${this.guiScale}`) } render () { return html`
Options