CI / test (push) Successful in 4s
This vendors BufferGeometryUtils, rewires GLTFLoader imports to local paths, and adds an import map fallback so bare three specifiers resolve correctly in browser. Made-with: Cursor
152 lines
4.1 KiB
HTML
152 lines
4.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>MapLibre GL + Three.js Asset Demo</title>
|
|
<link
|
|
rel="stylesheet"
|
|
href="./vendor/maplibre/maplibre-gl.css"
|
|
/>
|
|
<style>
|
|
:root {
|
|
color-scheme: dark;
|
|
}
|
|
body {
|
|
margin: 0;
|
|
font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
|
|
background: #0b1220;
|
|
color: #dbe5f6;
|
|
}
|
|
.layout {
|
|
display: grid;
|
|
grid-template-columns: 360px 1fr;
|
|
gap: 12px;
|
|
height: 100vh;
|
|
padding: 12px;
|
|
box-sizing: border-box;
|
|
}
|
|
.panel {
|
|
background: #10192c;
|
|
border: 1px solid #24344f;
|
|
border-radius: 12px;
|
|
padding: 12px;
|
|
overflow: auto;
|
|
}
|
|
h1 {
|
|
font-size: 18px;
|
|
margin: 0 0 10px;
|
|
}
|
|
h2 {
|
|
font-size: 14px;
|
|
margin: 14px 0 8px;
|
|
}
|
|
label {
|
|
display: block;
|
|
font-size: 12px;
|
|
margin-bottom: 4px;
|
|
color: #9eb0ce;
|
|
}
|
|
input,
|
|
button {
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
margin-bottom: 8px;
|
|
border-radius: 8px;
|
|
border: 1px solid #33496a;
|
|
background: #0d1525;
|
|
color: #e4ecfa;
|
|
padding: 8px 10px;
|
|
}
|
|
button {
|
|
cursor: pointer;
|
|
}
|
|
.muted {
|
|
font-size: 12px;
|
|
color: #9eb0ce;
|
|
}
|
|
.status {
|
|
font-size: 12px;
|
|
color: #8ee3a1;
|
|
min-height: 18px;
|
|
}
|
|
#map {
|
|
border-radius: 12px;
|
|
border: 1px solid #24344f;
|
|
}
|
|
.asset-card {
|
|
border: 1px solid #314869;
|
|
border-radius: 8px;
|
|
padding: 8px;
|
|
margin-bottom: 8px;
|
|
}
|
|
.asset-actions {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 8px;
|
|
margin-top: 8px;
|
|
}
|
|
@media (max-width: 980px) {
|
|
.layout {
|
|
grid-template-columns: 1fr;
|
|
grid-template-rows: auto 1fr;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="layout">
|
|
<div class="panel">
|
|
<h1>MapLibre GL + Three.js Demo</h1>
|
|
<div class="muted">
|
|
Raster tiles + 3D object placement. Click map to place, upload GLB/GLTF, store and share.
|
|
</div>
|
|
|
|
<h2>Connection</h2>
|
|
<label for="apiBase">API Base URL</label>
|
|
<input id="apiBase" value="http://localhost:8122" />
|
|
<button id="applyApi">Apply API URL</button>
|
|
|
|
<h2>Auth</h2>
|
|
<button id="ensureKeys">Ensure Keys</button>
|
|
<button id="register">Register</button>
|
|
<button id="login">Login</button>
|
|
<div class="muted" id="publicKeyPreview"></div>
|
|
|
|
<h2>Collection</h2>
|
|
<label for="collectionName">Name</label>
|
|
<input id="collectionName" value="MapLibre 3D objects demo" />
|
|
<button id="createCollection">Create Collection</button>
|
|
<div class="muted">Current: <span id="collectionInfo">none</span></div>
|
|
|
|
<h2>Place + Upload 3D/Image</h2>
|
|
<div class="muted">1) Click map for location 2) Select file 3) Upload and link</div>
|
|
<label for="assetFile">File</label>
|
|
<input id="assetFile" type="file" accept=".gltf,.glb,.jpg,.jpeg,.png,.webp" />
|
|
<label for="assetName">Asset name</label>
|
|
<input id="assetName" placeholder="Palm tree object" />
|
|
<label for="assetDesc">Description</label>
|
|
<input id="assetDesc" placeholder="3D object on the map" />
|
|
<button id="uploadAsset">Create Feature + Upload + Link</button>
|
|
|
|
<h2>Stored Assets</h2>
|
|
<div id="assetsList"></div>
|
|
<div class="status" id="status"></div>
|
|
</div>
|
|
|
|
<div id="map"></div>
|
|
</div>
|
|
|
|
<script src="./vendor/maplibre/maplibre-gl.js"></script>
|
|
<script type="importmap">
|
|
{
|
|
"imports": {
|
|
"three": "./vendor/three/three.module.js",
|
|
"three/": "./vendor/three/"
|
|
}
|
|
}
|
|
</script>
|
|
<script type="module" src="./maplibre-demo.js"></script>
|
|
</body>
|
|
</html>
|