Zoom buttons added

This commit is contained in:
Piotr Pekala
2019-04-03 03:31:14 -07:00
parent c3d8fd2399
commit 3c05b47032
8 changed files with 110 additions and 5 deletions

View File

@ -44,6 +44,7 @@ import { MapLink } from '../../cartography/models/map/map-link';
import { MapLinkToLinkConverter } from '../../cartography/converters/map/map-link-to-link-converter';
import { MovingEventSource } from '../../cartography/events/moving-event-source';
import { LinkWidget } from '../../cartography/widgets/link';
import { MapScaleService } from '../../services/mapScale.service';
@Component({
@ -110,7 +111,8 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
private selectionManager: SelectionManager,
private selectionTool: SelectionTool,
private recentlyOpenedProjectService: RecentlyOpenedProjectService,
private movingEventSource: MovingEventSource
private movingEventSource: MovingEventSource,
private mapScaleService: MapScaleService
) {}
ngOnInit() {
@ -381,6 +383,22 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.drawTools.visibility = true;
}
zoomIn() {
this.mapScaleService.setScale(this.mapScaleService.getScale() + 0.1);
}
zoomOut() {
let currentScale = this.mapScaleService.getScale();
if ((currentScale - 0.1) > 0) {
this.mapScaleService.setScale(currentScale - 0.1);
}
}
resetZoom() {
this.mapScaleService.resetToDefault();
}
public ngOnDestroy() {
this.drawingsDataSource.clear();
this.nodesDataSource.clear();