Reset list scrolling when changing game.

This commit is contained in:
Oliver Hamlet
2014-11-13 22:26:24 +00:00
parent ed2ad4ddc8
commit 0155d57861
+12 -2
View File
@@ -576,8 +576,18 @@ function changeGame(evt) {
loot.game.masterlist = gameInfo.masterlist;
loot.game.globalMessages = gameInfo.globalMessages;
loot.game.plugins = gameInfo.plugins;
document.getElementById('cardsNav').querySelector('core-list').data = loot.game.plugins;
document.getElementById('main').querySelector('core-list').data = loot.game.plugins;
/* Reset virtual list positions. */
document.getElementById('cardsNav').lastElementChild.scrollToItem(0);
document.getElementById('main').lastElementChild.scrollToItem(0);
/* Now update virtual lists. */
document.getElementById('cardsNav').lastElementChild.data = loot.game.plugins;
document.getElementById('main').lastElementChild.data = loot.game.plugins;
/* Update the list sizes to take into account data changes. */
document.getElementById('cardsNav').lastElementChild.updateSize();
document.getElementById('main').lastElementChild.updateSize();
} catch (e) {
console.log(e);
console.log('changeGame response: ' + result);