Skip to content

Commit

Permalink
Bug Fixed: Images plotting on Design Space while they are supposed li…
Browse files Browse the repository at this point in the history
…ve at the Charting Space
  • Loading branch information
Luis-Fernando-Molina committed Jan 31, 2021
1 parent 7fb25a6 commit a5634aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Projects/Superalgos/UI/Spaces/Charting-Space/ChartingSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function newSuperalgosChartingSpace() {
const MODULE_NAME = 'Charting Space'
const ERROR_LOG = true
const logger = newWebDebugLog()


let thisObject = {
visible: false,
Expand Down Expand Up @@ -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
}
}

Expand All @@ -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
}

Expand Down
10 changes: 6 additions & 4 deletions Projects/Superalgos/UI/Spaces/Charting-Space/Plotting/Plotter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down

0 comments on commit a5634aa

Please sign in to comment.