()
| 812 | const shellNames = Object.keys(shellTypes); |
| 813 | |
| 814 | function init() { |
| 815 | // Remove loading state |
| 816 | document.querySelector(".loading-init").remove(); |
| 817 | appNodes.stageContainer.classList.remove("remove"); |
| 818 | |
| 819 | // Populate dropdowns |
| 820 | function setOptionsForSelect(node, options) { |
| 821 | node.innerHTML = options.reduce((acc, opt) => (acc += `<option value="${opt.value}">${opt.label}</option>`), ""); |
| 822 | } |
| 823 | |
| 824 | // shell type |
| 825 | let options = ""; |
| 826 | shellNames.forEach((opt) => (options += `<option value="${opt}">${opt}</option>`)); |
| 827 | appNodes.shellType.innerHTML = options; |
| 828 | // shell size |
| 829 | options = ""; |
| 830 | ['3"', '4"', '6"', '8"', '12"', '16"'].forEach((opt, i) => (options += `<option value="${i}">${opt}</option>`)); |
| 831 | appNodes.shellSize.innerHTML = options; |
| 832 | |
| 833 | setOptionsForSelect(appNodes.quality, [ |
| 834 | { label: "低", value: QUALITY_LOW }, |
| 835 | { label: "正常", value: QUALITY_NORMAL }, |
| 836 | { label: "高", value: QUALITY_HIGH }, |
| 837 | ]); |
| 838 | |
| 839 | setOptionsForSelect(appNodes.skyLighting, [ |
| 840 | { label: "不", value: SKY_LIGHT_NONE }, |
| 841 | { label: "暗", value: SKY_LIGHT_DIM }, |
| 842 | { label: "正常", value: SKY_LIGHT_NORMAL }, |
| 843 | ]); |
| 844 | |
| 845 | // 0.9 is mobile default |
| 846 | setOptionsForSelect( |
| 847 | appNodes.scaleFactor, |
| 848 | [0.5, 0.62, 0.75, 0.9, 1.0, 1.5, 2.0].map((value) => ({ value: value.toFixed(2), label: `${value * 100}%` })) |
| 849 | ); |
| 850 | |
| 851 | // Begin simulation |
| 852 | togglePause(false); |
| 853 | |
| 854 | // initial render |
| 855 | renderApp(store.state); |
| 856 | |
| 857 | // Apply initial config |
| 858 | configDidUpdate(); |
| 859 | } |
| 860 | |
| 861 | function fitShellPositionInBoundsH(position) { |
| 862 | const edge = 0.18; |
no test coverage detected