Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Sep 16, 2023
1 parent 43c85d9 commit 638425e
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions zndraw/static/pycom/Cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ class Cache {

this._socket.on("atoms:insert", (data) => {
// move all keys after id one step forward
console.log(data);
const remainingKeys = Object.keys(this._cache);
const id = parseInt(Object.keys(data)[0]);
for (let i = remainingKeys.length - 1; i >= id; i--) {
Expand All @@ -134,19 +133,18 @@ class Cache {
}
// insert new atoms
this._cache[id] = new Atoms({
positions: data.positions,
cell: data.cell,
numbers: data.numbers,
colors: data.colors,
radii: data.radii,
connectivity: data.connectivity,
calc: data.calc,
positions: data[id].positions,
cell: data[id].cell,
numbers: data[id].numbers,
colors: data[id].colors,
radii: data[id].radii,
connectivity: data[id].connectivity,
calc: data[id].calc,
pbc: data[id].pbc,
});
// update slider
const slider = document.getElementById("frame-slider");
console.log(1);
slider.max = Object.keys(this._cache).length - 1;
console.log(2);
document.getElementById(
"info",
).innerHTML = `${slider.value} / ${slider.max}`;
Expand Down

0 comments on commit 638425e

Please sign in to comment.