@a2f0/skyline 0.2.66 → 0.2.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/package.md +2 -2
- package/package.json +2 -2
- package/site/skyline-3d.js +2 -1
- package/site/skyline-viewer.js +8 -3
- package/site/study-viewer.js +9 -1
package/docs/package.md
CHANGED
|
@@ -168,8 +168,8 @@ styles and the host's apart. `mountSkyline` returns at once with an instance:
|
|
|
168
168
|
|
|
169
169
|
The viewer shows what the embedded viewer always has: the traced loading silhouette,
|
|
170
170
|
the 3D skyline with its control bar, the twinkling stars, which come out after the
|
|
171
|
-
skyline's first frame, the OpenStreetMap credit, a small **show original** button until the first 3D frame (and again
|
|
172
|
-
graphics context is lost), so the original drawing stays reachable even if WebGL or
|
|
171
|
+
skyline's first frame, the OpenStreetMap credit, a small **show original** button until the first 3D frame (and again while the
|
|
172
|
+
graphics context is lost, until the browser restores it and the scene draws again), so the original drawing stays reachable even if WebGL or
|
|
173
173
|
the scene's code cannot load, building details in a panel over the skyline, and
|
|
174
174
|
reduced motion. `F`, pressed inside the viewer, shows its element fullscreen.
|
|
175
175
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2f0/skyline",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.68",
|
|
4
4
|
"description": "Interactive Chicago skyline viewer and reusable Three.js building models",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@a2f0/agent-tool": "0.1.
|
|
97
|
+
"@a2f0/agent-tool": "0.1.51",
|
|
98
98
|
"@tsconfig/strictest": "^2.0.8",
|
|
99
99
|
"@types/bun": "^1.4.4",
|
|
100
100
|
"esbuild": "0.28.2",
|
package/site/skyline-3d.js
CHANGED
|
@@ -45,7 +45,7 @@ function assertNever(value) {
|
|
|
45
45
|
// drawing's own camera and framed as the viewer frames the drawing, so each tower stands
|
|
46
46
|
// where its drawn one does until the camera moves. It renders into skyline-3d.html's own
|
|
47
47
|
// document, or into the viewer's shadow root, from the same markup.
|
|
48
|
-
export function startSkyline3d({ root, frame, assets, signal, colour: initiallyColoured = false, onShowOriginal, onReady, onUnavailable }) {
|
|
48
|
+
export function startSkyline3d({ root, frame, assets, signal, colour: initiallyColoured = false, onShowOriginal, onReady, onUnavailable, onRestored }) {
|
|
49
49
|
const document = root instanceof Document ? root : root.ownerDocument;
|
|
50
50
|
const listening = { signal };
|
|
51
51
|
const { models, ground, settings, drawingView, comparisonViews, labels } = createGeographicSkyline();
|
|
@@ -68,6 +68,7 @@ export function startSkyline3d({ root, frame, assets, signal, colour: initiallyC
|
|
|
68
68
|
frame,
|
|
69
69
|
signal,
|
|
70
70
|
onUnavailable,
|
|
71
|
+
onRestored,
|
|
71
72
|
models,
|
|
72
73
|
extras: [ground.group, roads],
|
|
73
74
|
defaultView: "skyline",
|
package/site/skyline-viewer.js
CHANGED
|
@@ -20,7 +20,9 @@ export function sceneTransition(status, event) {
|
|
|
20
20
|
case "failed":
|
|
21
21
|
return status === "booting" ? "unavailable" : status;
|
|
22
22
|
case "lost":
|
|
23
|
-
return "
|
|
23
|
+
return status === "booting" || status === "ready" ? "lost" : status;
|
|
24
|
+
case "restored":
|
|
25
|
+
return status === "lost" ? "ready" : status;
|
|
24
26
|
default:
|
|
25
27
|
return assertNever(event);
|
|
26
28
|
}
|
|
@@ -62,7 +64,7 @@ export function mount(root, { assets, signal, controls, colour, theme, attributi
|
|
|
62
64
|
root.append(viewer);
|
|
63
65
|
let mode = "3d";
|
|
64
66
|
// Both show original buttons wait while the scene boots, until its first frame, a failure
|
|
65
|
-
// to load, or a lost graphics context; the drawing stays reachable while
|
|
67
|
+
// to load, or a lost graphics context; the drawing stays reachable while the scene can't show.
|
|
66
68
|
let sceneStatus = "booting";
|
|
67
69
|
const toolbar = navigation ? createToolbar() : null;
|
|
68
70
|
function updateView() {
|
|
@@ -72,7 +74,7 @@ export function mount(root, { assets, signal, controls, colour, theme, attributi
|
|
|
72
74
|
drawing.src = new URL("skyline-original-fit.svg", assets).href;
|
|
73
75
|
drawing.hidden = mode !== "original";
|
|
74
76
|
originalReturn.hidden = mode !== "original";
|
|
75
|
-
embeddedOriginal.hidden = navigation || mode !== "3d" || sceneStatus
|
|
77
|
+
embeddedOriginal.hidden = navigation || mode !== "3d" || sceneStatus === "booting" || sceneStatus === "ready";
|
|
76
78
|
if (toolbar) {
|
|
77
79
|
for (const [name, toggle] of Object.entries(toggles)) {
|
|
78
80
|
const button = toolbar.querySelector(`#${toggle.id}`), showing = name === mode;
|
|
@@ -206,6 +208,9 @@ export function mount(root, { assets, signal, controls, colour, theme, attributi
|
|
|
206
208
|
onUnavailable() {
|
|
207
209
|
sendScene("lost");
|
|
208
210
|
},
|
|
211
|
+
onRestored() {
|
|
212
|
+
sendScene("restored");
|
|
213
|
+
},
|
|
209
214
|
});
|
|
210
215
|
});
|
|
211
216
|
}
|
package/site/study-viewer.js
CHANGED
|
@@ -32,7 +32,7 @@ export function createBuildingStudy({ models, defaultView = "quarter", views = {
|
|
|
32
32
|
front: { azimuth: Math.PI / 4, polar: Math.PI / 2 - 0.035, label: "front view" },
|
|
33
33
|
quarter: { azimuth: Math.PI / 4 + 0.22, polar: Math.PI / 2 - 0.15, label: "three-quarter view" },
|
|
34
34
|
side: { azimuth: Math.PI * 0.75, polar: Math.PI / 2 - 0.12, label: "side view" },
|
|
35
|
-
}, fov = 32, near = 1, far = 2000, clippingMargin = null, minimumDistanceRatio = 0.48, maximumDistanceRatio = 2, minimumZoom = 0.5, maximumZoom = 4, enablePan = false, target = [0, 85, 0], minimumCameraHeight = null, fit = { height: 230, width: 98 }, platform = { width: 76, depth: 76 }, lightPosition = [-110, 240, 170], shadowCamera = { left: -140, right: 140, top: 160, bottom: -160, near: 1, far: 600 }, extras = [], layouts = null, initialLayout = "original", onLayoutChange = () => { }, labels = [], turntable = false, root = document, frame = null, signal = new AbortController().signal, onReady = () => { }, onUnavailable = () => { }, }) {
|
|
35
|
+
}, fov = 32, near = 1, far = 2000, clippingMargin = null, minimumDistanceRatio = 0.48, maximumDistanceRatio = 2, minimumZoom = 0.5, maximumZoom = 4, enablePan = false, target = [0, 85, 0], minimumCameraHeight = null, fit = { height: 230, width: 98 }, platform = { width: 76, depth: 76 }, lightPosition = [-110, 240, 170], shadowCamera = { left: -140, right: 140, top: 160, bottom: -160, near: 1, far: 600 }, extras = [], layouts = null, initialLayout = "original", onLayoutChange = () => { }, labels = [], turntable = false, root = document, frame = null, signal = new AbortController().signal, onReady = () => { }, onUnavailable = () => { }, onRestored = () => { }, }) {
|
|
36
36
|
const original = { models, extras, fit, target, platform, lightPosition, shadowCamera, clippingMargin };
|
|
37
37
|
let layout = "original";
|
|
38
38
|
const document = root instanceof Document ? root : root.ownerDocument;
|
|
@@ -566,6 +566,14 @@ export function createBuildingStudy({ models, defaultView = "quarter", views = {
|
|
|
566
566
|
loading.hidden = false;
|
|
567
567
|
onUnavailable();
|
|
568
568
|
}, listening);
|
|
569
|
+
// Preventing the loss's default asks the browser to restore the context, and Three.js rebuilds
|
|
570
|
+
// its state from the scene when it does: the study then draws its picture again and drops the
|
|
571
|
+
// interruption, rather than leaving it over a context that works.
|
|
572
|
+
canvas.addEventListener("webglcontextrestored", () => {
|
|
573
|
+
root.querySelector("#loading").hidden = true;
|
|
574
|
+
onRestored();
|
|
575
|
+
requestRender();
|
|
576
|
+
}, listening);
|
|
569
577
|
resizing.observe(viewport);
|
|
570
578
|
updateMotionPreference();
|
|
571
579
|
// Open on the default view with its own frame, target, and eye distance, if it sets any.
|