Bug Fixed: Images plotting on Design Space while they are supposed live at the Charting Space

This commit is contained in:
Luis Fernando Molina committed 2021-01-31 17:50:51 +01:00
1 parent 7fb25a639f
commit a5634aa38e
2 files changed
+10 -8

No files matched your search

@@ -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
}
@@ -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.')