BlazorGoogleMaps icon indicating copy to clipboard operation
BlazorGoogleMaps copied to clipboard

AdvancedMarkerView.

Open vishalsmart opened this issue 2 years ago • 31 comments

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

vishalsmart avatar Nov 12 '22 09:11 vishalsmart

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

valentasm1 avatar Nov 12 '22 09:11 valentasm1

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

vishalsmart avatar Nov 12 '22 09:11 vishalsmart

awesome. Any method which suits you. Here some similar issues https://github.com/rungwiroon/BlazorGoogleMaps/issues/83 https://github.com/rungwiroon/BlazorGoogleMaps/issues/62

valentasm1 avatar Nov 12 '22 09:11 valentasm1

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.

vishalsmart avatar Nov 12 '22 10:11 vishalsmart

@vishalsmart any progress on this?

alelom avatar Jan 31 '23 22:01 alelom

@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

vishaljani23 avatar Mar 19 '23 08:03 vishaljani23

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 avatar Mar 19 '23 08:03 valentasm1

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

valentasm1 avatar Mar 26 '23 10:03 valentasm1

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

vishalsmart avatar Apr 03 '23 05:04 vishalsmart

Awesome :).

valentasm1 avatar Apr 03 '23 05:04 valentasm1

@valentasm1 what about PR? :)

dkosinskyi avatar Jun 30 '23 12:06 dkosinskyi

I never promised PR. I think you refering @vishalsmart

valentasm1 avatar Jun 30 '23 12:06 valentasm1

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

coeur85 avatar Sep 18 '23 02:09 coeur85

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

valentasm1 avatar Sep 18 '23 04:09 valentasm1

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

yes i'm tagging him

coeur85 avatar Sep 18 '23 07:09 coeur85

@vishalsmart how are you? what about PR?)

dkosinskyi avatar Sep 18 '23 11:09 dkosinskyi

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

valentasm1 avatar Sep 18 '23 11:09 valentasm1

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

coeur85 avatar Sep 18 '23 14:09 coeur85

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

valentasm1 avatar Sep 18 '23 14:09 valentasm1

image

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

coeur85 avatar Sep 18 '23 14:09 coeur85

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

valentasm1 avatar Sep 18 '23 14:09 valentasm1

@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 avatar Sep 18 '23 14:09 Nickztar

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/

Nickztar avatar Sep 18 '23 14:09 Nickztar

@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

coeur85 avatar Sep 18 '23 14:09 coeur85

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.

Nickztar avatar Sep 18 '23 14:09 Nickztar

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

valentasm1 avatar Sep 18 '23 14:09 valentasm1

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

Nickztar avatar Sep 18 '23 15:09 Nickztar

sure you don't need my help

coeur85 avatar Sep 21 '23 08:09 coeur85

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.

valentasm1 avatar Oct 25 '23 05:10 valentasm1

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 👍🏼

Nickztar avatar Oct 25 '23 06:10 Nickztar