Skip to content

armgit / Aleph

Public Imported from GitHub
0

Give satellite imagery, terrain data, buildings, streetview photos to your LLM

UI improvements

Belluxx8217cd5e7a66
diff --git a/src/web/app.js b/src/web/app.js
index 35b52a3..0197fee 100644
--- a/src/web/app.js
+++ b/src/web/app.js
@@ -25,6 +25,9 @@ const ICONS = {
terrain: '<path d="M2 20 9 8l4 6 3-4 6 10z"/>',
mesh: '<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9zM4 7.5l8 4.5 8-4.5M12 12v9"/>',
map: '<path d="M12 4l9 5-9 5-9-5zM3 14l9 5 9-5"/>',
+ sides: '<circle cx="12" cy="12" r="2"/><path d="M8 12H3m3-3-3 3 3 3M16 12h5m-3-3 3 3-3 3"/>',
+ sphere: '<circle cx="12" cy="12" r="9"/><ellipse cx="12" cy="12" rx="9" ry="3.5"/><ellipse cx="12" cy="12" rx="3.5" ry="9"/>',
+ pencil: '<path d="M4 20l1.2-4.2L16.5 4.5l3 3L8.2 18.8zM14.5 6.5l3 3"/>',
};
// Progress phases that a capture stage row already shows.
const DOWNLOADS = new Set(["Street View", "Satellite", "Downloading terrain tiles", "3D mesh"]);
@@ -414,11 +417,25 @@ function updateForm() {
range.style.setProperty("--steps", max - min);
$(".knob", range).textContent = input.value;
$(".tag", range).textContent = SCALES[input.name][input.value];
+ placeTag(range);
}
- $("#preview-button").disabled = !state.area || !options.include.length;
+ renderPreviewButton();
store.set("options", options);
}
+// Center the level name under the thumb, kept inside the slider.
+function placeTag(range) {
+ const input = $("input", range), tag = $(".tag", range), width = range.clientWidth;
+ const center = (input.value - input.min) / (input.max - input.min) * (width - 24) + 12;
+ tag.style.left = `${Math.max(0, Math.min(width - tag.offsetWidth, center - tag.offsetWidth / 2))}px`;
+}
+
+function renderPreviewButton() {
+ const button = $("#preview-button"), sources = readForm().include.length;
+ button.disabled = !state.area || !sources;
+ button.textContent = !sources ? "Select one or more sources first" : !state.area ? "Draw an area first" : "Preview";
+}
+
let estimateTimer = null;
let estimateCount = 0;
@@ -450,10 +467,10 @@ function estimate() {
function renderArea() {
const area = state.area;
- $("#redraw").textContent = state.drawing ? "Cancel" : area ? "Redraw" : "Draw area";
+ $("#redraw").innerHTML = state.drawing ? "Cancel" : `${icon("pencil")}${area ? "Redraw" : "Draw area"}`;
$("#area").innerHTML = area ? `<strong>${esc(dimensions(area))}</strong>`
: `<span class="muted">${state.drawing ? "Drag on the map to draw it." : "No area yet."}</span>`;
- $("#preview-button").disabled = !area || !readForm().include.length;
+ renderPreviewButton();
}
// Progress
@@ -1006,7 +1023,10 @@ async function init() {
$("#root").textContent = state.config.root;
$("#root").title = state.config.root;
for (const slot of $$("[data-icon]")) slot.outerHTML = icon(slot.dataset.icon);
- fillForm({...state.config.defaults, ...store.get("options", {})});
+ fillForm({...state.config.defaults, include: [], ...store.get("options", {})});
+ // Sliders start hidden inside closed sources, so their level names are placed once shown.
+ const resized = new ResizeObserver(entries => entries.forEach(entry => placeTag(entry.target)));
+ for (const range of $$(".range")) resized.observe(range);
const view = store.get("view", {center: [12.49, 41.89], zoom: 2});
map = new maplibregl.Map({container: "map", style: await basemap(), center: view.center, zoom: view.zoom,
diff --git a/src/web/index.html b/src/web/index.html
index 932f48b..1ca3e49 100644
--- a/src/web/index.html
+++ b/src/web/index.html
@@ -83,8 +83,8 @@
<label class="field"><span>Spacing</span><span class="unit"><input type="number" name="step" min="1" step="any"><i>m</i></span></label>
<label class="field"><span>Camera</span>
<span class="segmented">
- <label><input type="radio" name="camera" value="sides"><span>Left + right</span></label>
- <label><input type="radio" name="camera" value="sphere"><span>360° sphere</span></label>
+ <label><input type="radio" name="camera" value="sides"><span><i data-icon="sides"></i>Left + right</span></label>
+ <label><input type="radio" name="camera" value="sphere"><span><i data-icon="sphere"></i>360° sphere</span></label>
</span>
</label>
<label class="field" data-camera="sides"><span>Field of view</span><span class="unit"><input type="number" name="fov" min="5" max="175" step="1"><i>°</i></span></label>
diff --git a/src/web/style.css b/src/web/style.css
index 103b62e..a068ad3 100644
--- a/src/web/style.css
+++ b/src/web/style.css
@@ -221,7 +221,9 @@ input[type=range]::-moz-range-thumb { width: 24px; height: 18px; border: 0; bord
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
- display: block;
+ display: flex;
+ align-items: center;
+ gap: 5px;
padding: 3px 8px;
border: 1px solid var(--line);
margin-left: -1px;
@@ -233,9 +235,20 @@ input[type=range]::-moz-range-thumb { width: 24px; height: 18px; border: 0; bord
.segmented input:checked + span { position: relative; border-color: var(--ink); background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
-.unit { display: inline-flex; align-items: center; gap: 4px; }
-.unit i { color: var(--muted); font: 12px var(--mono); font-style: normal; width: 10px; }
-/* The knob number and level name follow the thumb, which is 24px wide. */
+/* The unit sits inside the input, so inputs with and without one line up. */
+.unit { position: relative; display: inline-flex; }
+.unit input { padding-right: 18px; }
+.unit i {
+ position: absolute;
+ right: 6px;
+ top: 50%;
+ transform: translateY(-50%);
+ color: var(--muted);
+ font: 12px var(--mono);
+ font-style: normal;
+ pointer-events: none;
+}
+/* The knob number follows the thumb, which is 24px wide; script centers the level name under it. */
.field.slider { flex-direction: column; align-items: stretch; gap: 6px; }
.range { position: relative; display: block; height: 38px; }
.range::before {
@@ -263,8 +276,7 @@ input[type=range]::-moz-range-thumb { width: 24px; height: 18px; border: 0; bord
.tag {
position: absolute;
top: 23px;
- left: calc(var(--at) * (100% - 24px) + 12px);
- transform: translateX(calc(var(--at) * -100%));
+ left: 0;
font-size: 12px;
white-space: nowrap;
pointer-events: none;
@@ -330,6 +342,7 @@ input[type=range]::-moz-range-thumb { width: 24px; height: 18px; border: 0; bord
stroke-width: 1.4;
stroke-linejoin: miter;
}
+.small .icon, .segmented .icon { width: 13px; height: 13px; }
.bar { height: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }