hmmm, stuff
This commit is contained in:
parent
2ed7602595
commit
5979e53d91
3 changed files with 32 additions and 23 deletions
|
@ -192,19 +192,23 @@ tavern.onmovetoken = (m) => {
|
|||
}
|
||||
tavern.onshowscene = (show) => {
|
||||
let map = document.getElementById('map');
|
||||
map.style.visibility = show.background == undefined ? 'hidden' : 'visible';
|
||||
// Remove existing tokens
|
||||
Array.from(map.children).filter(c => c.classList.contains('token')).forEach(c => map.removeChild(c));
|
||||
|
||||
let background = document.getElementById('map-background');
|
||||
gridOffset = show.grid_offset;
|
||||
Array.from(document.getElementsByClassName('token')).forEach(t => {
|
||||
t.children[0].style.width = `${gridSize}px`;
|
||||
t.children[0].style.height = `${gridSize}px`;
|
||||
});
|
||||
// I think this is pointless as we remove all the tokens just a couple of lines above
|
||||
// Array.from(document.getElementsByClassName('token')).forEach(t => {
|
||||
// t.children[0].style.width = `${gridSize}px`;
|
||||
// t.children[0].style.height = `${gridSize}px`;
|
||||
// });
|
||||
gridSize = show.grid_cell_size;
|
||||
background.src = show.background ?? '';
|
||||
for (let token of show.tokens) {
|
||||
tavern.onspawntoken(token);
|
||||
if (show.background != undefined) {
|
||||
background.src = show.background;
|
||||
for (let token of show.tokens) {
|
||||
tavern.onspawntoken(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
tavern.onscenelist = (list) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue