Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using negative longitude marker doesn't show. #120

Open
s-komzarev opened this issue Mar 26, 2021 · 2 comments
Open

When using negative longitude marker doesn't show. #120

s-komzarev opened this issue Mar 26, 2021 · 2 comments

Comments

@s-komzarev
Copy link

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

@leftstick
Copy link
Owner

@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

@s-komzarev
Copy link
Author

s-komzarev commented Apr 20, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants