angular2-baidu-map icon indicating copy to clipboard operation
angular2-baidu-map copied to clipboard

When using negative longitude marker doesn't show.

Open s-komzarev opened this issue 4 years ago • 2 comments

i have an issue with markers. I have code: <baidu-map [options]="opts" (loaded)="mapLoaded($event)"> <ng-container> <marker-clusterer [options]="clustererOptions" (loaded)="clustererLoaded($event)" > </marker-clusterer> </ng-container> </baidu-map> and markers is { "markers": [ { "point": { "lat": 51.5083458, "lng": "-0.1" } }, { "point": { "lat": 52.246124, "lng": 0.3 } }, { "point": { "lat": 51.244604, "lng": 0 } } ] } and result is image We see points 52.246124, 0.3 and 51.244604, 0. but point with coordinates 51.5083458, -0.1 doesn't show. In dom this point exists but property left: 78629.4px Any ideas how can I fix this

s-komzarev avatar Mar 26 '21 11:03 s-komzarev

@s-komzarev I believe that is a bug with BaiduMap SDK JavaScript API v3.0 which i used for angular2-baidu-map.

I tried to switch back to BaiduMap SDK JavaScript API v2.0, the marker can be displayed well.

I am thinking if there is any risk of changing back to API 2.0, or maybe you will help to verify it?

  1. Change 3.0 to 2.0 in following code:

https://github.com/leftstick/angular2-baidu-map/blob/master/projects/lib/src/lib/providers/mapService.ts#L38

  1. rebuild the lib with yarn build

leftstick avatar Mar 29 '21 03:03 leftstick

It works thanks. I have a new task that I'm having trouble with. I need to display the marker information using a component. It should be something like this.

` exampleComponent { @ViewChild('cardTemplate', { static: false }) templateContent: TemplateRef;

showWindow(marker): void {

this.map.openInfoWindow(
   new window.BMap.InfoWindow(this.templateContent, {
     offset: new window.BMap.Size(0, -30),
     title: 'Title'
  }),
   marker.getPosition()
);

} } `

and html <baidu-map [options]="opts" (loaded)="mapLoaded($event)"> <marker-clusterer [options]="clustererOptions" (loaded)="clustererLoaded($event)"> </marker-clusterer> </baidu-map> <ng-template #cardTemplate> <app-center-card></app-center-card> </ng-template> Perhaps you can help me with this?

s-komzarev avatar Apr 20 '21 12:04 s-komzarev