fix(preview): retain signal poles in building ghost mode

This commit is contained in:
2026-08-07 15:51:40 +08:00
parent a749abf00c
commit aeb2cec021

View File

@@ -293,8 +293,9 @@
async function setBuildingGhost(enabled) { async function setBuildingGhost(enabled) {
const roads = assets.find((asset) => asset.id === "roads"); const roads = assets.find((asset) => asset.id === "roads");
const buildings = assets.find((asset) => asset.id === "buildings"); const buildings = assets.find((asset) => asset.id === "buildings");
const props = assets.find((asset) => asset.id === "vegetation");
const main = assets.find((asset) => asset.id === "main"); const main = assets.find((asset) => asset.id === "main");
if (!roads || !buildings || !main) { if (!roads || !buildings || !props || !main) {
toggleBuildingGhost.checked = false; toggleBuildingGhost.checked = false;
toggleBuildingGhost.disabled = true; toggleBuildingGhost.disabled = true;
return; return;
@@ -303,8 +304,9 @@
const loaded = await Promise.all([ const loaded = await Promise.all([
loadAsset(viewer, roads, placement), loadAsset(viewer, roads, placement),
loadAsset(viewer, buildings, placement), loadAsset(viewer, buildings, placement),
loadAsset(viewer, props, placement),
]); ]);
if (!loaded[0] || !loaded[1]) { if (!loaded[0] || !loaded[1] || !loaded[2]) {
toggleBuildingGhost.checked = false; toggleBuildingGhost.checked = false;
setStatus("Building transparency unavailable"); setStatus("Building transparency unavailable");
return; return;
@@ -312,6 +314,9 @@
main.model.show = false; main.model.show = false;
roads.model.show = true; roads.model.show = true;
buildings.model.show = true; buildings.model.show = true;
// The semantic vegetation asset also owns the static traffic-signal
// poles/housings from the 05_Props collection.
props.model.show = true;
buildings.model.color = Cesium.Color.WHITE.withAlpha(0.22); buildings.model.color = Cesium.Color.WHITE.withAlpha(0.22);
buildings.model.colorBlendMode = Cesium.ColorBlendMode.REPLACE; buildings.model.colorBlendMode = Cesium.ColorBlendMode.REPLACE;
buildings.model.colorBlendAmount = 1.0; buildings.model.colorBlendAmount = 1.0;
@@ -368,7 +373,8 @@
void setBuildingGhost(toggleBuildingGhost.checked); void setBuildingGhost(toggleBuildingGhost.checked);
}); });
if (!semanticAssets(assets).some((asset) => asset.id === "roads") || if (!semanticAssets(assets).some((asset) => asset.id === "roads") ||
!semanticAssets(assets).some((asset) => asset.id === "buildings")) { !semanticAssets(assets).some((asset) => asset.id === "buildings") ||
!semanticAssets(assets).some((asset) => asset.id === "vegetation")) {
toggleBuildingGhost.disabled = true; toggleBuildingGhost.disabled = true;
} }