Skip to content

Commit

Permalink
fix shape display
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Geihs committed May 21, 2024
1 parent 3603890 commit 2b1663c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ui/tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,24 @@ export function initTileModal(viewer: Viewer, tiles: TileEntity[], earth: EARTH)
return `${addr.substring(0, 10)}${addr.substring(addr.length-8)}`;
}

function formatShape(t: TileEntity): string {
const l = tiles[index].coordinates.length / 2;
if (l == 5) {
return "Pentagon";
} else if (l == 6) {
return "Hexagon";
}
return "unknown";
}

const pos = tiles[index].position.getValue(viewer.clock.currentTime);
const center = Cartographic.fromCartesian(pos);

// Update HTML elements.
document.getElementById('tile-modal-index').innerHTML = `${index.toString()}`;
document.getElementById('tile-modal-coordinates').innerHTML = formatCoordinates(tiles[index].coordinates);
document.getElementById('tile-modal-center').innerHTML = formatLatLng(center.latitude, center.longitude);
document.getElementById('tile-modal-shape').innerHTML = tiles[index].coordinates.length==5?"Pentagon":"Hexagon";
document.getElementById('tile-modal-shape').innerHTML = formatShape(tiles[index]);
document.getElementById('tile-modal-owner').innerHTML = minted ? formatOwner(owner) : 'none';
document.getElementById('tile-modal-mint').style.display = minted ? 'none' : 'initial';

Expand Down

0 comments on commit 2b1663c

Please sign in to comment.