fengxiang
2018-07-04 7ca521e4267b987270f6ccbb9a6c076aeb467d96
src/app/routes/map/coordinates-picker/coordinates-picker.component.ts
@@ -1,6 +1,6 @@
import { NzModalSubject } from 'ng-zorro-antd';
import { ReactiveFormsModule } from '@angular/forms';
import { ViewEncapsulation, Component,  ViewChild, ElementRef, NgZone } from '@angular/core';
import { ViewEncapsulation, Component,  ViewChild, ElementRef, NgZone, OnInit } from '@angular/core';
import { MapOptions, Point, MarkerOptions, ControlAnchor, NavigationControlOptions, NavigationControlType, BMapInstance } from 'angular2-baidu-map';
import { CoorPicker } from '@business/entity/data';
import { CoorPickerService } from 'app/routes/map/coordinates-picker/coordinates-picker.service';
@@ -13,7 +13,7 @@
  templateUrl: './coordinates-picker.component.html',
  styleUrls: [ './coordinates-picker.component.css' ],
})
export class CoordinatesPickerComponent {
export class CoordinatesPickerComponent implements OnInit {
    Default_LNG = 121;
    Default_LAT = 31.4;
    isSaving = false;
@@ -30,6 +30,9 @@
    _BMap: any = null;
  constructor(private subject: NzModalSubject, private coorPickerService: CoorPickerService) {
  }
  ngOnInit(): void {
    this.data = this.coorPickerService.data;
    let lng = this.data.longitude;
    lng = lng === 0 || lng == null ? this.Default_LNG : lng;
@@ -69,7 +72,7 @@
           width: -15
        }
       };
  }
  }
  private _marker: any = null;
  loadMarker(marker) {
    if (this._marker == null) {
@@ -84,7 +87,7 @@
      this._map.addEventListener(
        'tilesloaded',
        (type, fn) => {
           this._map.clearOverlays();
          //  this._map.clearOverlays();
           this._map.addOverlay(this._marker);          
        }
      );