Update bring-to-front-action.component.ts

This commit is contained in:
piotrpekala7 2020-03-16 17:43:31 +01:00
parent ac3335a33d
commit 1622d7d60a

View File

@ -26,15 +26,20 @@ export class BringToFrontActionComponent implements OnInit {
ngOnInit() {}
bringToFront() {
let maxZValueForNodes = Math.max(...this.nodes.map(n => n.z));
let maxZValueForDrawings = Math.max(...this.drawings.map(n => n.z));
let maxZValue = Math.max(maxZValueForNodes, maxZValueForDrawings);
if (maxZValue < 100) maxZValue++;
this.nodes.forEach((node) => {
node.z = 100;
node.z = maxZValue;
this.nodesDataSource.update(node);
this.nodeService.update(this.server, node).subscribe((node: Node) => {});
});
this.drawings.forEach((drawing) => {
drawing.z = 100;
drawing.z = maxZValue;
this.drawingsDataSource.update(drawing);
this.drawingService.update(this.server, drawing).subscribe((drawing: Drawing) => {});