From 1ba3f59fddf22ebd970169786356eba2fca49c07 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 8 Oct 2019 09:12:52 +0200 Subject: [PATCH] Tyding in order to extend the code --- Panels/ProductsPanel.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 117b7e996..f56e9fd6e 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -29,7 +29,7 @@ function newProductsPanel () { /* Needed Variables */ - let lastY = 5 + const CANRD_SEPARATION = 5 let panelTabButton let exchange @@ -105,9 +105,7 @@ function newProductsPanel () { } productCard.container.frame.position.x = position.x - productCard.container.frame.position.y = position.y + lastY - - lastY = lastY + productCard.container.frame.height + productCard.container.frame.position.y = position.y + productCard.container.frame.height * thisObject.productCards.length + CANRD_SEPARATION /* Add to the Product Array */ @@ -148,7 +146,6 @@ function newProductsPanel () { if (firstVisibleCard > (thisObject.productCards.length - availableSlots + 1)) { firstVisibleCard = thisObject.productCards.length - availableSlots + 1 } visibleProductCards = [] - let lastY = 5 for (let i = 0; i < thisObject.productCards.length; i++) { if (i + 1 >= firstVisibleCard && i + 1 < firstVisibleCard + availableSlots) { @@ -161,9 +158,7 @@ function newProductsPanel () { 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 + productCard.container.frame.position.y = position.y + productCard.container.frame.height * visibleProductCards.length + CANRD_SEPARATION /* Add to Visible Product Array */ @@ -235,7 +230,6 @@ function newProductsPanel () { function physics () { if (isInitialized === false) { return } - console.log('PHYSICS!!!') } function draw () {