From a5634aa38e286ae48c2eefc6fb7aaee7d715e9aa Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 31 Jan 2021 17:50:51 +0100 Subject: [PATCH] Bug Fixed: Images plotting on Design Space while they are supposed live at the Charting Space --- .../UI/Spaces/Charting-Space/ChartingSpace.js | 8 ++++---- .../UI/Spaces/Charting-Space/Plotting/Plotter.js | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Projects/Superalgos/UI/Spaces/Charting-Space/ChartingSpace.js b/Projects/Superalgos/UI/Spaces/Charting-Space/ChartingSpace.js index f2a7cc380a..4b5624541d 100644 --- a/Projects/Superalgos/UI/Spaces/Charting-Space/ChartingSpace.js +++ b/Projects/Superalgos/UI/Spaces/Charting-Space/ChartingSpace.js @@ -10,7 +10,7 @@ function newSuperalgosChartingSpace() { const MODULE_NAME = 'Charting Space' const ERROR_LOG = true const logger = newWebDebugLog() - + let thisObject = { visible: false, @@ -252,8 +252,8 @@ function newSuperalgosChartingSpace() { returnPoint.y = COCKPIT_SPACE_POSITION } } else { - if (point.y > COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2) { - returnPoint.y = COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2 + if (point.y > COCKPIT_SPACE_POSITION) { + returnPoint.y = COCKPIT_SPACE_POSITION } } @@ -273,7 +273,7 @@ function newSuperalgosChartingSpace() { return false } - if (point.y > COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2) { + if (point.y > COCKPIT_SPACE_POSITION) { return false } diff --git a/Projects/Superalgos/UI/Spaces/Charting-Space/Plotting/Plotter.js b/Projects/Superalgos/UI/Spaces/Charting-Space/Plotting/Plotter.js index 563f473b5b..73affa0b62 100644 --- a/Projects/Superalgos/UI/Spaces/Charting-Space/Plotting/Plotter.js +++ b/Projects/Superalgos/UI/Spaces/Charting-Space/Plotting/Plotter.js @@ -812,14 +812,16 @@ function newPlotter() { y: dataPointObject.y } dataPoint = UI.projects.superalgos.spaces.chartingSpace.viewport.fitIntoVisibleArea(dataPoint) - dataPoint = thisObject.fitFunction(dataPoint) - imagePosition.x = dataPoint.x - imagePosition.y = dataPoint.y + imagePosition.x = dataPoint.x - imageSize / 2 + offsetX + imagePosition.y = dataPoint.y - imageSize / 2 - offsetY + + imagePosition = thisObject.fitFunction(imagePosition) + let imageToDraw = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', imageName) if (imageToDraw !== undefined) { if (imageToDraw.canDrawIcon === true) { - browserCanvasContext.drawImage(imageToDraw, imagePosition.x - imageSize / 2 + offsetX, imagePosition.y - imageSize / 2 - offsetY, imageSize, imageSize) + browserCanvasContext.drawImage(imageToDraw, imagePosition.x , imagePosition.y , imageSize, imageSize) } } else { console.log('Can not plot image named ' + imageName + ' of product ' + productDefinition.name + ' because it does not exist.')