Product Cards orders not altered by image loading order

This commit is contained in:
Luis Fernando Molina committed 2018-11-10 16:17:23 +01:00
1 parent 79de43da8a
commit 69e0dc4242
2 files changed
+28 -51

No files matched your search

+28 -34
View File
@@ -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) {
-17
View File
@@ -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;