gns3-web-ui/src/app/services/mapScale.service.ts
2019-04-03 03:31:14 -07:00

31 lines
773 B
TypeScript

import { Injectable, EventEmitter } from '@angular/core';
import { Context } from '../cartography/models/context';
@Injectable()
export class MapScaleService {
public currentScale: number;
public scaleChangeEmitter = new EventEmitter();
constructor(
private context: Context
) {
this.currentScale = 1;
}
getScale() {
return this.currentScale;
}
setScale(newScale: number) {
this.currentScale = newScale;
this.context.transformation.k = this.currentScale;
this.scaleChangeEmitter.emit(this.currentScale);
}
resetToDefault() {
this.currentScale = 1;
this.context.transformation.k = this.currentScale;
this.scaleChangeEmitter.emit(this.currentScale);
}
}