From f0825075a9ea56ce19b8cc604ee4dbb3917523b2 Mon Sep 17 00:00:00 2001 From: "mati108@gmail.com" <34651529+matbenitez@users.noreply.github.com> Date: Mon, 8 Oct 2018 17:00:37 -0300 Subject: [PATCH] Adding temporary bot image --- ProductCard.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/ProductCard.js b/ProductCard.js index c6d2d9404..cfbe4cadf 100644 --- a/ProductCard.js +++ b/ProductCard.js @@ -69,6 +69,10 @@ let teamAvatar; // stores the avatar image of the team the bot portrayed at this card belongs to. let teamAvatarLoaded = false; + /* TODO Temporary code */ + let botAvatar; // stores the avatar image of the team the bot portrayed at this card belongs to. + let botAvatarLoaded = false; + return thisObject; function initialize() { @@ -162,7 +166,20 @@ const STORAGE_URL = "https://algobotcommstorage.blob.core.windows.net"; const TEAM = thisObject.devTeam.codeName.toLowerCase(); - teamAvatar.src = STORAGE_URL + "/" + TEAM + "/" + TEAM + "-" + "avatar.jpg"; + teamAvatar.src = STORAGE_URL + "/" + TEAM + "/" + TEAM + "-" + "banner.jpg"; + + /* + TODO Temporary code: Here we will temporary download the images of bots uploaded at the Teams Module. + */ + + botAvatar = new Image(); + botAvatar.onload = onImageLoadBot; + + function onImageLoadBot() { + botAvatarLoaded = true; + } + + botAvatar.src = STORAGE_URL + "/" + TEAM + "/" + TEAM + "-" + "avatar.jpg"; } @@ -421,7 +438,16 @@ botImagePoint = thisObject.container.frame.frameThisPoint(botImagePoint); let imageId = thisObject.bot.devTeam + "." + thisObject.bot.profilePicture; - let botImage = document.getElementById(imageId); + //let botImage = document.getElementById(imageId); + + /* TODO Temporary code */ + let botImage; + + if (botAvatarLoaded === false) { + botImage = document.getElementById(imageId); + } else { + botImage = botAvatar; + } if (botImage.naturalHeight !== 0) { browserCanvasContext.drawImage(botImage, botImagePoint.x, botImagePoint.y, botImageSize, botImageSize);