Update node.service.ts

This commit is contained in:
piotrpekala7
2020-06-17 13:49:05 +02:00
parent 57490b7272
commit 220bda22f5

View File

@ -72,8 +72,8 @@ export class NodeService {
xPosition = Math.round((xPosition + node.width/2) / project.grid_size) * project.grid_size; xPosition = Math.round((xPosition + node.width/2) / project.grid_size) * project.grid_size;
yPosition = Math.round((yPosition + node.height/2) / project.grid_size) * project.grid_size; yPosition = Math.round((yPosition + node.height/2) / project.grid_size) * project.grid_size;
xPosition = Math.round(xPosition - node.width/2); xPosition = Math.round(xPosition - node.width/2) - ((project.scene_width - (Math.floor(project.scene_width / project.grid_size) * project.grid_size)) / 2);
yPosition = Math.round(yPosition - node.height/2); yPosition = Math.round(yPosition - node.height/2) - ((project.scene_height - (Math.floor(project.scene_height / project.grid_size) * project.grid_size)) / 2);
} }
return this.httpServer.put<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}`, { return this.httpServer.put<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}`, {