Add file browser stuff

This commit is contained in:
kolaflash
2025-12-12 16:06:03 +01:00
parent c5ceebdecb
commit 448d203c74
3 changed files with 150 additions and 0 deletions
+39
View File
@@ -5,6 +5,11 @@ import { currentScene } from "#/engine/Scene.ts";
import { setScale, viewport } from "#/engine/Viewport.ts";
import { InputField } from "#/tools/controls/InputField.tsx";
import { RangeSlider } from "#/tools/controls/RangeSlider.tsx";
import {
type BrowserFile,
type BrowserFolder,
FileBrowser,
} from "./FileBrowser.tsx";
import {
ArrowAutofitHeightIcon,
ArrowAutofitWidthIcon,
@@ -12,6 +17,38 @@ import {
ZoomScanIcon,
} from "./icons/index.ts";
const root = new Map<string, BrowserFile | BrowserFolder>([
[
"foo",
{
path: "/foo.file",
},
],
[
"bar",
{
path: "/bar.file",
},
],
[
"folder",
new Map([
[
"fuzz",
{
path: "/fuzz.file",
},
],
[
"buzz",
{
path: "/buzz.file",
},
],
]),
],
]);
function adjustGameContainer(gameContainer: HTMLElement, width: number): void {
gameContainer.style = `position: relative; top: 0; left: ${width}px; width: ${document.body.offsetWidth - width}px;`;
}
@@ -90,6 +127,8 @@ const DevTools: Component<{ gameContainer: HTMLElement }> = ({
}}
></InputField>
</div>
<FileBrowser root={root} />
</div>
<div class="tool-bar-resize" onMouseDown={startResizing}></div>
</div>