Skip to content

Commit

Permalink
Merge pull request #16 from vorth/show-first
Browse files Browse the repository at this point in the history
Show first tetrahedron initially
  • Loading branch information
vorth authored Nov 25, 2023
2 parents f241bb8 + 27abf58 commit e72b069
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 254 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h1>

<div class="viewer">
<h1 id="index"></h1>
<vzome-viewer id="viewer" src="vZomeLogo.vZome" />
<vzome-viewer id="viewer" load-camera="always" />
</div>
</div>

Expand Down
36 changes: 17 additions & 19 deletions tetra-listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,28 @@ let selectedRow;
const table = document.getElementById( "partsTable" );
const tbody = table.createTBody();
for (const tetra of models) {
const id = tetra.id;
const url = tetra.url;
const chiral = (tetra.chiral === "true");
const tr = tbody.insertRow();
fillRow(tr, tetra);
tr.addEventListener("click",
function (event) {
if(url) {
switchModel(url);
} else {
alert("Tetrahedron #" + id + " is not available.\n\nPlease help us collect the full set.");
}
if ( selectedRow ) selectedRow.className = "";
selectedRow = tr;
selectedRow.className = "selected";
const index = document.getElementById( "index" );
index.textContent = id;
}
);
tr.addEventListener("click", () => selectTetra( tetra, tr ) );
}
selectTetra( models[ 0 ], tbody .rows[ 0 ] );

function selectTetra( tetra, tr ) {
const { url, id } = tetra;
if(url) {
switchModel(url);
} else {
alert("Tetrahedron #" + id + " is not available.\n\nPlease help us collect the full set.");
}
if ( selectedRow ) selectedRow.className = "";
selectedRow = tr;
selectedRow.className = "selected";
const index = document.getElementById( "index" );
index.textContent = id;
}

function fillRow(tr, tetra) {
const id = tetra.id;
const url = tetra.url;
const { id, url } = tetra;
const chiral = (tetra.chiral === "true");
if(!tr.id) {
tr.id = "tetra-" + id;
Expand Down
234 changes: 0 additions & 234 deletions vZomeLogo.vZome

This file was deleted.

0 comments on commit e72b069

Please sign in to comment.