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

fix: jsModule is null for basemap layer #337

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,10 @@ public async Task AddLayer(Layer layer, bool isBasemapLayer = false)
{
Map!.Layers.Add(layer);
layer.Parent ??= Map;
layer.JsModule ??= ViewJsModule;
}

layer.JsModule ??= ViewJsModule;

if (ViewJsModule is null) return;

if (ProJsViewModule is not null && layer.GetType().Namespace!.Contains("Pro"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,35 @@
base.BuildRenderTree(__builder);
}

@code {
@code {
[TestMethod]
public async Task TestCanSetBaseMapLayerVisibility(Action renderHandler)
{
MapView? mapView = null;
async Task OnViewInitialized()
{
await mapView!.AddLayer(new ImageryTileLayer() { Url = "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer" }, isBasemapLayer: true );
}
AddMapRenderFragment(
@<MapView OnViewInitialized="@OnViewInitialized" @ref="@mapView" class="map-view" OnViewRendered="renderHandler">
<Map>
<Basemap>
<PortalItem Id="55ebf90799fa4a3fa57562700a68c405" />
</Basemap>
</Map>
</MapView>);

await WaitForMapToRender();

ImageryTileLayer? imageryTileLayer = mapView!.Map!.Basemap!.Layers.OfType<ImageryTileLayer>().SingleOrDefault();

Assert.IsNotNull(imageryTileLayer);
Assert.IsNotNull(imageryTileLayer.JsModule);

await imageryTileLayer.SetVisibility(false);

Assert.IsFalse(imageryTileLayer.Visible);
}

[TestMethod]
public async Task TestCanRenderArcGisDefaultBasemap(Action renderHandler)
Expand Down
Loading