Merge branch 'master' into Lock/unlock-all-items-on-map

This commit is contained in:
Piotr Pekala
2019-06-28 01:06:47 -07:00
31 changed files with 730 additions and 33 deletions

View File

@ -42,7 +42,9 @@ import { MapLabelToLabelConverter } from '../../cartography/converters/map/map-l
import { RecentlyOpenedProjectService } from '../../services/recentlyOpenedProject.service';
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';
import { NodeCreatedLabelStylesFixer } from './helpers/node-created-label-styles-fixer';
import { MapSettingService } from '../../services/mapsettings.service';
@ -112,8 +114,10 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
private selectionManager: SelectionManager,
private selectionTool: SelectionTool,
private recentlyOpenedProjectService: RecentlyOpenedProjectService,
private nodeCreatedLabelStylesFixer: NodeCreatedLabelStylesFixer,
private mapSettingsService: MapSettingService
private mapSettingsService: MapSettingService,
private movingEventSource: MovingEventSource,
private mapScaleService: MapScaleService,
private nodeCreatedLabelStylesFixer: NodeCreatedLabelStylesFixer
) {}
ngOnInit() {
@ -187,6 +191,18 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
this.mapChangeDetectorRef.detectChanges();
})
);
this.addKeyboardListeners();
}
addKeyboardListeners() {
Mousetrap.bind('ctrl++', (event: Event) => {
event.preventDefault();
});
Mousetrap.bind('ctrl+-', (event: Event) => {
event.preventDefault();
});;
}
onProjectLoad(project: Project) {
@ -311,7 +327,8 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
public toggleMovingMode() {
this.tools.moving = !this.tools.moving;
this.toolsService.movingToolActivation(this.tools.moving);
this.movingEventSource.movingModeState.emit(this.tools.moving);
if (!this.readonly) {
this.tools.selection = !this.tools.moving;
this.toolsService.selectionToolActivation(this.tools.selection);
@ -377,6 +394,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 uploadImageFile(event) {
this.readImageFile(event.target);
}