diff --git a/src/app/components/project-map/project-map.component.html b/src/app/components/project-map/project-map.component.html index 6014383b..4580560d 100644 --- a/src/app/components/project-map/project-map.component.html +++ b/src/app/components/project-map/project-map.component.html @@ -115,6 +115,12 @@ settings_applications + + + + diff --git a/src/app/components/project-map/project-map.component.ts b/src/app/components/project-map/project-map.component.ts index 14732ed9..fbe54469 100644 --- a/src/app/components/project-map/project-map.component.ts +++ b/src/app/components/project-map/project-map.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; +import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation, ElementRef } from '@angular/core'; import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { Observable, Subject, Subscription, from } from 'rxjs'; @@ -394,6 +394,17 @@ export class ProjectMapComponent implements OnInit, OnDestroy { }); } + public centerView() { + if (this.project) { + let scrollX: number = (this.project.scene_width - document.documentElement.clientWidth) > 0 ? (this.project.scene_width - document.documentElement.clientWidth)/2 : 0; + let scrollY: number = (this.project.scene_height - document.documentElement.clientHeight) > 0 ? (this.project.scene_height - document.documentElement.clientHeight)/2 : 0; + + window.scrollTo(scrollX, scrollY); + } else { + this.toasterService.error('Please wait until all components are loaded.'); + } + } + public onDrawingSaved() { this.projectMapMenuComponent.resetDrawToolChoice(); }