diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 1554e5215..004fb7b05 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -84,7 +84,34 @@ productCard.container.parentContainer = thisObject.container; productCard.container.isWheelable = true; - productCard.container.eventHandler.listenToEvent("Images Loaded", addProductCardToArray) + /* Positioning within thisObject Panel */ + + let position = { + x: 10, + y: thisObject.container.frame.height - thisObject.container.frame.getBodyHeight() + }; + + productCard.container.frame.position.x = position.x; + productCard.container.frame.position.y = position.y + lastY; + + lastY = lastY + productCard.container.frame.height; + + /* Add to the Product Array */ + + productCards.push(productCard); + + /* Add to Visible Product Array */ + + if (productCard.container.frame.position.y + productCard.container.frame.height < thisObject.container.frame.height) { + + visibleProductCards.push(productCard); + + } + + /* Listen to Status Changes Events */ + + productCard.container.eventHandler.listenToEvent('Status Changed', onProductCardStatusChanged); + productCard.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel); } } @@ -96,39 +123,6 @@ } - function addProductCardToArray(productCard) { - - /* Positioning within thisObject Panel */ - - let position = { - x: 10, - y: thisObject.container.frame.height - thisObject.container.frame.getBodyHeight() - }; - - productCard.container.frame.position.x = position.x; - productCard.container.frame.position.y = position.y + lastY; - - lastY = lastY + productCard.container.frame.height; - - /* Add to the Product Array */ - - productCards.push(productCard); - - /* Add to Visible Product Array */ - - if (productCard.container.frame.position.y + productCard.container.frame.height < thisObject.container.frame.height) { - - visibleProductCards.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) { diff --git a/ProductCard.js b/ProductCard.js index 06bc01a24..025dfcb27 100644 --- a/ProductCard.js +++ b/ProductCard.js @@ -212,7 +212,6 @@ function onLegacyImageLoad() { legacyTeamAvatarLoaded = true; - imageLoaded(); } legacyTeamAvatar.src = window.canvasApp.urlPrefix + "Images/" + LEGACY_TEAM + "/" + LEGACY_TEAM + ".png"; @@ -223,7 +222,6 @@ function onLegacyImageLoadBot() { legacyBotAvatarLoaded = true; thisObject.bot.avatar = legacyBotAvatar; - imageLoaded(); } legacyBotAvatar.src = window.canvasApp.urlPrefix + "Images/" + LEGACY_TEAM + "/" + REPO + "/" + PROFILE_PIC; @@ -244,7 +242,6 @@ function onImageLoad() { teamAvatarLoaded = true; - imageLoaded(); } teamAvatar.src = window.canvasApp.context.teamProfileImages.get(TEAM); @@ -255,7 +252,6 @@ function onImageLoadBot() { botAvatarLoaded = true; thisObject.bot.avatar = botAvatar; - imageLoaded(); } botAvatar.src = window.canvasApp.context.fbProfileImages.get(TEAM + "-" + BOT); @@ -263,19 +259,6 @@ } } - 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;