1- import { Injectable } from "@angular/core" ;
1+ import { EventEmitter , Injectable } from "@angular/core" ;
22import { TrainrunSectionService } from "../data/trainrunsection.service" ;
33import { UiInteractionService } from "../ui/ui.interaction.service" ;
44import { NodeService } from "../data/node.service" ;
55import { NoteService } from "../data/note.service" ;
66import { Vec2D } from "../../utils/vec2D" ;
77import { Node } from "../../models/node.model" ;
88import { ViewportCullService } from "../ui/viewport.cull.service" ;
9+ import { NodeOperation , Operation , OperationType } from "src/app/models/operation.model" ;
910
1011@Injectable ( {
1112 providedIn : "root" ,
@@ -19,6 +20,7 @@ export class PositionTransformationService {
1920 private readonly viewportCullService : ViewportCullService ,
2021 ) {
2122 }
23+ readonly operation = new EventEmitter < Operation > ( ) ;
2224
2325 private scaleFullNetzgrafikArea ( factor : number , zoomCenter : Vec2D , windowViewboxPropertiesMapKey : string ) {
2426 const scaleCenterCoordinates : Vec2D = this . computeScaleCenterCoordinates ( zoomCenter , windowViewboxPropertiesMapKey ) ;
@@ -135,6 +137,7 @@ export class PositionTransformationService {
135137 if ( leftX !== undefined ) {
136138 nodes . forEach ( ( n ) => {
137139 n . setPosition ( leftX , n . getPositionY ( ) ) ;
140+ this . operation . emit ( new NodeOperation ( OperationType . update , n ) ) ;
138141 } ) ;
139142 }
140143
@@ -157,6 +160,7 @@ export class PositionTransformationService {
157160 if ( rightX !== undefined ) {
158161 nodes . forEach ( ( n ) => {
159162 n . setPosition ( rightX - n . getNodeWidth ( ) , n . getPositionY ( ) ) ;
163+ this . operation . emit ( new NodeOperation ( OperationType . update , n ) ) ;
160164 } ) ;
161165 }
162166
@@ -179,6 +183,7 @@ export class PositionTransformationService {
179183 if ( topY !== undefined ) {
180184 nodes . forEach ( ( n ) => {
181185 n . setPosition ( n . getPositionX ( ) , topY ) ;
186+ this . operation . emit ( new NodeOperation ( OperationType . update , n ) ) ;
182187 } ) ;
183188 }
184189
@@ -201,6 +206,7 @@ export class PositionTransformationService {
201206 if ( bottomY !== undefined ) {
202207 nodes . forEach ( ( n ) => {
203208 n . setPosition ( n . getPositionX ( ) , bottomY - n . getNodeHeight ( ) ) ;
209+ this . operation . emit ( new NodeOperation ( OperationType . update , n ) ) ;
204210 } ) ;
205211 }
206212
0 commit comments