All bots without picture or team picture are not shown at the products panel. Fix #37

This commit is contained in:
Luis Fernando Molina committed 2018-10-31 07:55:46 +01:00
1 parent f3fd5987a6
commit fb164af205
2 files changed
+36 -8

No files matched your search

+14 -8
View File
@@ -104,14 +104,7 @@
}
/* Add to the Product Array */
productCards.push(productCard);
/* Listen to Status Changes Events */
productCard.container.eventHandler.listenToEvent('Status Changed', onProductCardStatusChanged);
productCard.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel);
productCard.container.eventHandler.listenToEvent("Images Loaded", addProductCardToArray)
}
}
@@ -123,6 +116,19 @@
}
function addProductCardToArray(productCard) {
/* Add to the Product Array */
productCards.push(productCard);
/* Listen to Status Changes Events */
productCard.container.eventHandler.listenToEvent('Status Changed', onProductCardStatusChanged);
productCard.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel);
}
function onMouseWheel(pDelta) {
if (pDelta > 0) {
+22
View File
@@ -93,6 +93,11 @@
let botAvatar; // stores the avatar image of the team the bot portrayed at this card belongs to.
let botAvatarLoaded = false;
/* Add an Event Handler */
thisObject.eventHandler = newEventHandler();
let imagesLoaded = 0;
return thisObject;
function initialize() {
@@ -189,6 +194,7 @@
function onLegacyImageLoad() {
legacyTeamAvatarLoaded = true;
imageLoaded();
}
legacyTeamAvatar.src = WEB_URL + "/Images/" + LEGACY_TEAM + "/" + LEGACY_TEAM + ".png";
@@ -212,6 +218,7 @@
function onLegacyPlotterBanner() {
legacyPlotterBannerLoaded = true;
imageLoaded();
}
legacyPlotterBanner.src = WEB_URL + "/Images/" + PLOTTER_TEAM + "/" + PLOTTER_REPO + "/" + PLOTTER_PROFILE_PIC;
@@ -231,6 +238,7 @@
function onImageLoad() {
teamAvatarLoaded = true;
imageLoaded();
}
teamAvatar.src = STORAGE_URL + "/" + TEAM + "/" + TEAM + "-" + "avatar.jpg";
@@ -245,12 +253,26 @@
function onImageLoadBot() {
botAvatarLoaded = true;
thisObject.bot.avatar = botAvatar;
imageLoaded();
}
botAvatar.src = STORAGE_URL + "/" + TEAM + "/" + TEAM + "-" + "banner.jpg";
}
function imageLoaded() {
/* We need 2 images, one for the team and one for the bot, to consider this Card valid and able to be shown. */
imagesLoaded++;
if (imagesLoaded === 2) {
thisObject.container.eventHandler.raiseEvent("Images Loaded", thisObject);
}
}
function getContainer(point) {
var container;