AW-6046 Angular improvement
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, Host, Input, OnChanges, OnInit } from '@angular/core';
|
||||
import { MapComponent } from 'ng-openlayers';
|
||||
import {IMapState} from '../../../models/map.state'
|
||||
import {View} from 'ol';
|
||||
import { View } from 'ol';
|
||||
import { fromLonLat } from 'ol/proj';
|
||||
import { IMapState } from '../../../models/map.state';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -29,7 +29,7 @@ export class PanToLocation implements OnInit,OnChanges{
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
ngOnChanges() {
|
||||
// if (changes.position && this.instance) {
|
||||
// var p = changes.position.currentValue as Position;
|
||||
// this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
|
||||
@@ -64,17 +64,17 @@ export class PanToLocation implements OnInit,OnChanges{
|
||||
const newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
|
||||
const extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500];
|
||||
const options = { padding: [0, 0, 0, 0],minResolution:1 };
|
||||
const size = this.map.instance.getSize();
|
||||
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
const threshold = 44 * rem;
|
||||
let left = 1 * rem;
|
||||
const right = 1 * rem;
|
||||
let bottom = Math.round(size[1] / 2);
|
||||
const top = 1 * rem;
|
||||
if (size[0] > threshold) {
|
||||
bottom = 1 * rem;
|
||||
left = 23 * rem;
|
||||
}
|
||||
//const size = this.map.instance.getSize();
|
||||
//const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
//const threshold = 44 * rem;
|
||||
//let left = 1 * rem;
|
||||
//const right = 1 * rem;
|
||||
//let bottom = Math.round(size[1] / 2);
|
||||
//const top = 1 * rem;
|
||||
//if (size[0] > threshold) {
|
||||
// bottom = 1 * rem;
|
||||
// left = 23 * rem;
|
||||
//}
|
||||
//options.padding = [top, right, bottom, left];
|
||||
if (this.animate) options["duration"] = 2000;
|
||||
view.fit(extent, options);
|
||||
|
Reference in New Issue
Block a user