Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
MINOR: tileWrappingEnabled fixes (#1767)
Browse files Browse the repository at this point in the history
- Added test
- Log warning when set and projection is spherical
  • Loading branch information
nzjony committed Aug 14, 2020
1 parent 1e4316d commit 9ea8668
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions @here/harp-mapview/lib/MapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,10 @@ export class MapView extends EventDispatcher {
}

set tileWrappingEnabled(enabled: boolean) {
if (this.projection.type === ProjectionType.Spherical) {
logger.warn("Setting this with spherical projection has no affect. Was this intended?");
return;
}
if (enabled !== this.m_tileWrappingEnabled) {
this.m_tileWrappingEnabled = enabled;
this.m_visibleTiles = this.createVisibleTileSet();
Expand Down
16 changes: 16 additions & 0 deletions @here/harp-mapview/test/MapViewTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,22 @@ describe("MapView", function() {
}
});

it("correctly set and get tile wrapping mode", function() {
mapView = new MapView({ canvas, projection: mercatorProjection });
const vts = mapView.visibleTileSet;
mapView.tileWrappingEnabled = false;
expect(mapView.tileWrappingEnabled).equal(false);
const vts2 = mapView.visibleTileSet;
// Ensure the VisibleTileSet was recreated
expect(vts).to.be.not.equal(vts2);
});

it("ignore set and get tile wrapping mode for sphere projection", function() {
mapView = new MapView({ canvas, projection: sphereProjection });
mapView.tileWrappingEnabled = false;
expect(mapView.tileWrappingEnabled).equal(true);
});

it("supports #dispose", async function() {
const dataSource = new FakeOmvDataSource({ name: "omv" });
const dataSourceDisposeStub = sinon.stub(dataSource, "dispose");
Expand Down

0 comments on commit 9ea8668

Please sign in to comment.