Comments (9)
control is not positioned as TOP_LEFT but as BOTTOM_CENTER. this is different bug. Not related to serialization. Solved with #281
from blazorgooglemaps.
I believe it is another bug. Upon running the Blazor Server Demo and examining the MapLegendPage, I observed that its intended position, TOP_LEFT, is not reflected in the actual placement; it appears at BOTTOM_CENTER instead. During debugging, I noticed that the addControl method in the objectManager is receiving "topLeft" as the enum value. However, this doesn't seem to match any case in the switch statement, causing it to revert to the default case of BOTTOM_CENTER.
I initially noticed this in my current application when trying to position the control on RIGHT_CENTER.
using System.Threading.Tasks;
using GoogleMapsComponents;
using GoogleMapsComponents.Maps;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace ServerSideDemo.Pages;
public partial class MapLegendPage
{
private GoogleMap map1;
private MapOptions mapOptions;
[Inject] private IJSRuntime jsRuntime { get; set; }
protected ElementReference legendReference { get; set; }
protected override void OnInitialized()
{
mapOptions = new MapOptions()
{
Zoom = 13,
Center = new LatLngLiteral()
{
Lat = 13.505892,
Lng = 100.8162
},
MapTypeId = MapTypeId.Roadmap
};
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await jsRuntime.InvokeAsync<object>("initMapLegend");
}
}
private async Task AfterMapInit()
{
await map1.InteropObject.AddControl(ControlPosition.TopLeft, legendReference);
}
}
from blazorgooglemaps.
Please register new issue then. One bug one issue.
from blazorgooglemaps.
I can do that, I just thought that since it was a caused by the serialization it was one bigger issue, that control position was just one case where I noticed it. But I understand that it might be a separate thing and could be fixed with less of a code change.
I will create a issue for only the control position and and a pull request only for that.
from blazorgooglemaps.
No need PR. Just sample of code how it should is enough since change is very small
from blazorgooglemaps.
I merger PR. It dont work. I tried for 30min and give up. Reverted.
If you do functionality. Startup server demo and try markers diff func, drawing polygons, polylines. Maybe smth else.
I am a bit disappointed.
from blazorgooglemaps.
Sry my bad, I should have tested it more. I will update the code so that it works and thoroughly test it.
from blazorgooglemaps.
I've been digging into this, and experimenting with a different custom serializer for enums.
I've come to the conclusion that a big part of the problem is due to the use of discriminated unions (OneOf) for various properties. If a type has a property that uses OneOf, the OneOfConverterFactory
is used to serialize that property and does so by using the default serializer for whichever of the underlying types is being used. So, for example, in the case of the Symbol
class, the Path
property is a discriminated union: OneOf<SymbolPath, string>
. The SymbolPath
type is an enum and will serialize properly using the custom serializer (e.g., JsonStringEnumConverterEx
), but not when it is part of a OneOf
as is the case here.
I experimented with making the Path
property just a simple SymbolPath
instead of OneOf<SymbolPath, string>
and that worked.
I've been trying to work out how to have the OneOfConverterFactory
use the appropriate serializer for each of the possible types in the discriminated union, but haven't got there yet.
I just thought I'd add this comment here in case anyone else has an idea how to achieve this.
from blazorgooglemaps.
Sharing knowledge is always great. Thank you.
from blazorgooglemaps.
Related Issues (20)
- Accessing the map object via javascript HOT 4
- Working with encoded polylines. HOT 2
- Multiple Ground Overlays HOT 3
- DrawingManager.SetDrawingMode no longer works in 3.3.2 and newer HOT 7
- Add class DragEndEvent for dragend listener (Suggestion) HOT 1
- MarkerClustering - Set Click on Zoom level; HOT 2
- polygonList not rendering the polygons HOT 9
- Advanced Markers server side demo dont work anymore HOT 4
- Link KeyProvider to map object scope instead of application level static HOT 2
- Advanced Marker Support HOT 4
- AdvancedMapMarker Microsoft.JSInterop.JSException: function not found HOT 1
- Enabling Dependabot for repository
- AdvancedMarkerElementOptions - Content Invalid (not an instance of Node) HOT 13
- New method services.AddBlazorGoogleMaps("YOUR_KEY_GOES_HERE"); only is used in Maps, not other components HOT 1
- Blazor web app demo HOT 1
- Removed map HTMLElement from DOM still try to render map HOT 14
- Add Support for PinElement (AdvancedMarkerElement Customization) HOT 8
- AdvancedMarker from svg HOT 4
- Add way to set AdvancedMarker properties HOT 6
- Feature: Traffic, Transit and Bicycle Layer HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazorgooglemaps.