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

AdvancedMarkerView. #217

Closed
vishalsmart opened this issue Nov 12, 2022 · 35 comments
Closed

AdvancedMarkerView. #217

vishalsmart opened this issue Nov 12, 2022 · 35 comments

Comments

@vishalsmart
Copy link

Hi,

Can you please implement AdvancedMarkerView as well?

https://developers.google.com/maps/documentation/javascript/advanced-markers/html-markers#maps_advanced_markers_html-javascript

Regards,

Vishal

@valentasm1
Copy link
Collaborator

Sorry but i am out of time. Only minor changes fixes.

@vishalsmart
Copy link
Author

I am trying to implement, if I will be success, shall I create PR?

@valentasm1
Copy link
Collaborator

awesome. Any method which suits you. Here some similar issues
#83
#62

@vishalsmart
Copy link
Author

Thanks, I have success for implementing AdvancedMarkerView but need beta version of google map. Will explore more possibilities and will create check-in once all well tested.

@alelom
Copy link

alelom commented Jan 31, 2023

@vishalsmart any progress on this?

@vishaljani23
Copy link
Contributor

@alelom @valentasm1 AdvancedMarkerView is still in Beta. Instead I have used RichMarker to achieve HTML markers. If @valentasm1 agrees, I can bit optimize my implementation and create PR to merge including richmarker https://github.com/googlearchive/js-rich-marker

@valentasm1
Copy link
Collaborator

I am in progress migrating from json.net to system.text.json. Need some testing and adding some atributes. Most of work is done. I will finish next sunday. After that you could make PR :). I will put reminder and will write here update.

@valentasm1
Copy link
Collaborator

Everything looks working on migration to system.text.json, just need some testing and will release next week
https://github.com/rungwiroon/BlazorGoogleMaps/tree/system.text.json_migration

@vishalsmart
Copy link
Author

I tested and looks improved performance. I'm going to create PR for RichMarker in day or two.

@valentasm1
Copy link
Collaborator

Awesome :).

@dkosinskyi
Copy link

@valentasm1 what about PR? :)

@valentasm1
Copy link
Collaborator

I never promised PR. I think you refering @vishalsmart

@coeur85
Copy link

coeur85 commented Sep 18, 2023

@valentasm1 , can you push it as a draft at least?

@valentasm1
Copy link
Collaborator

I never promised PR. I think you refering @vishalsmart he said he will be ready in 2d (April 2023 :) )

@coeur85
Copy link

coeur85 commented Sep 18, 2023

I never promised PR. I think you refering @vishalsmart he said he will be ready in 2d (April 2023 :) )

yes i'm tagging him

@dkosinskyi
Copy link

@vishalsmart how are you? what about PR?)

valentasm1 pushed a commit that referenced this issue Sep 18, 2023
@valentasm1
Copy link
Collaborator

I like this part from article
Advanced Markers can load up to 66% faster than our traditional markers, and provide faster panning and zooming.
https://cloud.google.com/blog/products/maps-platform/announcing-highly-customizable-higher-performance-markers

Just did quick draft. Doesnt look that it could be very complicated to implement from here.
https://github.com/rungwiroon/BlazorGoogleMaps/releases/tag/3.2.0

@coeur85
Copy link

coeur85 commented Sep 18, 2023

I managed to add this part, and so far it looks like a standard marker, I was working on adding the content parameter to the advanced maker, and this is where things got missy

@valentasm1
Copy link
Collaborator

There is huge chance that you need to write exception in js file. There are already couple exception to some actions.

@coeur85
Copy link

coeur85 commented Sep 18, 2023

image

i want to help , been working on this all day today

@valentasm1
Copy link
Collaborator

Sorry but if i need to guide you is such cases i could implement it faster. I dont have much free time.
@Nickztar have you any thoughts about AdvancedMarkerView

@Nickztar
Copy link
Contributor

@coeur85 Would recommend going to the google docs, the error also says that the problem is that content is not a Node. Node is a HTMLElement (like a div or w/e).

https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions.content

Not sure how its currently handled in our library but we would have to send a reference to a htmlElement or do something about that. Might have a look tomorrow to see if I can help figure it out.

@Nickztar
Copy link
Contributor

Maybe you could allow the user to pass a ElementReference for content. That should be a Node when recieved by JS.

https://blazor-university.com/javascript-interop/calling-javascript-from-dotnet/passing-html-element-references/

@coeur85
Copy link

coeur85 commented Sep 18, 2023

@Nickztar it should a dom object like a div true, so I tried to pass as on object from JS function but got the same error
image

@Nickztar
Copy link
Contributor

Nickztar commented Sep 18, 2023

Well from what I can see you are just passing the string ´await CreateDiv(innerHTML)´? We would have to have something that overrides the call to CreateAdvancedMarker and calls that method (which sounds like a bad idea). You should probably just change Content to be a ElementReference and have the user call their own CreateDiv method which returns a ElementReference.

@valentasm1
Copy link
Collaborator

Wrong thinking. Content must by node since all params is serialized before passing to google maps passing reference is impossible.
https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions.content

Need some workaround like here
https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/GoogleMapsComponents/wwwroot/js/objectManager.js#L603

@Nickztar
Copy link
Contributor

A ElementReference is serializable though? Alteast when passing to JS. Should be possible without a workaround. I will try tomorrow. 😄

@coeur85
Copy link

coeur85 commented Sep 21, 2023

sure you don't need my help

@valentasm1
Copy link
Collaborator

valentasm1 commented Oct 25, 2023

Tomorrow never comes :).
I brute force and added just string property. Then do check in js.
@Nickztar I tried to play ElementReference but unable to make it work. Even tho, if it could work then need to create separate ElementReference since gmaps dont duplicate if you pass same node.
https://github.com/rungwiroon/BlazorGoogleMaps/releases/tag/3.2.1
https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/ServerSideDemo/Pages/AdvancedMarkerViewPage.razor
Guy need opinion if it work. Maybe it super duper slow.

@Nickztar
Copy link
Contributor

Oh I have completely forgotten about it. This solution looks fine, maybe i'll get some more time soon and can try to do the elementReference. The "non-duplication" thing sounds like a feature to me, could save us from having to update the marker if it works as I think.

I guess a good solution might be to make Content a OneOf<string, ElementReference> but this should be fine until (if?) we figure it out 👍🏼

@valentasm1
Copy link
Collaborator

For sure what is missing PinElement . It could be again issues since it is HTMLElement. In other hand it dont have much properties and dont have much use case. IMO this view is most usefull for html content markers.

@valentasm1
Copy link
Collaborator

As of February 21st, 2024 (v3.56), google.maps.Marker is deprecated. We encourage you to transition to the new google.maps.marker.AdvancedMarkerElement class. Advanced markers provide substantial improvements over the legacy google.maps.Marker class. The minimum version of the Maps JavaScript API with google.maps.marker.AdvancedMarkerElement is 3.53.2. At this time, google.maps.Marker is not scheduled to be discontinued.

https://developers.google.com/maps/documentation/javascript/markers
I will add this info to this library too and then close this issue.

@valentasm1
Copy link
Collaborator

I dont think i need to add this to library since same info appears to browser console.

@EGInsider
Copy link

@valentasm1 Is there a AdvancedMarkerElement implementation available now??

@valentasm1
Copy link
Collaborator

There is. It just use old naming AdvancedMarkerView. Google just renamed it to AdvancedMarkerElement
https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/ServerSideDemo/Pages/AdvancedMarkerViewPage.razor

#327

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

8 participants