Skip to content
Open
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
2 changes: 1 addition & 1 deletion modules/google-maps/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export function getViewPropsFromCoordinateTransformer(

// Match Google projection matrix
const fovy = 25;
const aspect = height ? width / height : 1;
const aspect = width > 0 && height > 0 ? width / height : 1;

// Match depth range (crucial for correct z-sorting)
const near = 0.75;
Expand Down
36 changes: 36 additions & 0 deletions test/modules/google-maps/google-maps-overlay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,42 @@ test('GoogleMapsOverlay#style', () => {
overlay.finalize();
});

test('GoogleMapsOverlay#draw tolerates a zero-width vector map', async () => {
const map = new mapsApi.Map({
width: 0,
height: 600,
longitude: -122.45,
latitude: 37.78,
zoom: 13,
renderingType: mapsApi.RenderingType.VECTOR
});
let resolveDeviceInitialized = () => {};
const deviceInitialized = new Promise<void>(resolve => {
resolveDeviceInitialized = resolve;
});
const overlay = new GoogleMapsOverlay({
device,
interleaved: false,
onDeviceInitialized: () => resolveDeviceInitialized(),
layers: [
new ScatterplotLayer({
data: [{position: [-122.45, 37.78]}],
getPosition: datum => datum.position,
radiusMinPixels: 10
})
]
});

overlay.setMap(map);
await deviceInitialized;

try {
expect(() => map.draw()).not.toThrow();
} finally {
overlay.finalize();
}
});

function drawPickTest(renderingType) {
test(`GoogleMapsOverlay#draw, pick ${renderingType}`, () => {
const map = new mapsApi.Map({
Expand Down