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

Icons Size and Anchor in webassembly core hosted #41

Open
Bisjob opened this issue Jun 22, 2020 · 4 comments
Open

Icons Size and Anchor in webassembly core hosted #41

Bisjob opened this issue Jun 22, 2020 · 4 comments

Comments

@Bisjob
Copy link

Bisjob commented Jun 22, 2020

Hi, thanks for your Leaflet wrapper !
I'm using it in a webassembly core hosted (.NET Core 3.1), and when I set a size or an Anchor to a marker, there a not added to the map anymore. I never stop to my breakpoint at the begining addMarker function in leafletBlazorInterops.js

I think this is an sort of incompatibility width Size? and Point? types.

I replaced

public Size? Size { get; set; }
public Point? Anchor { get; set; }

by

public int Width { get; set; }
public int Height { get; set; }
public int AnchorX { get; set; }
public int AnchorY { get; set; }

and

iconSize: icon.size ? L.point(icon.size.value.width, icon.size.value.height) : null,
iconAnchor: icon.anchor ? L.point(icon.anchor.value.x, icon.anchor.value.y) : null,

by

iconSize: (icon.width != 0 && icon.height != 0) ? L.point(icon.width, icon.height) : null,
iconAnchor: (icon.anchorX != 0 || icon.anchorY != 0) ? L.point(icon.anchorX, icon.anchorY) : null,

to make it works

@chucker
Copy link
Contributor

chucker commented Jul 11, 2020

It appears to be something about how Blazor WASM serializes nullable value types. (Still investigating.)

@chucker
Copy link
Contributor

chucker commented Jul 12, 2020

This appears to be a Blazor issue. https://github.com/dotnet/aspnetcore/issues/23885

chucker pushed a commit to chucker/BlazorLeaflet that referenced this issue Jul 16, 2020
chucker pushed a commit to chucker/BlazorLeaflet that referenced this issue Jul 16, 2020
@johannesmols
Copy link

I have the same issue still with .NET 5. @Rizov74's fix works luckily.

@markus-renezeder
Copy link

I have the same issue in .NET Core 5, Blazor Server Side. @Rizov74 fix works fine!

charleypeng added a commit to charleypeng/BlazorLeaflet that referenced this issue May 6, 2022
Yeetii added a commit to Yeetii/BlazorLeaflet-net6.0 that referenced this issue Nov 16, 2022
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

4 participants