diff --git a/samples/add-map/index.ts b/samples/add-map/index.ts index 764bb2f899..77fc72eec9 100644 --- a/samples/add-map/index.ts +++ b/samples/add-map/index.ts @@ -13,8 +13,7 @@ async function initMap(): Promise { const position = { lat: -25.344, lng: 131.031 }; // Request needed libraries. - //@ts-ignore - const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; + const { Map, RenderingType } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary; // The map, centered at Uluru @@ -24,6 +23,7 @@ async function initMap(): Promise { zoom: 4, center: position, mapId: 'DEMO_MAP_ID', + renderingType: RenderingType.VECTOR, } ); // [END maps_add_map_instantiate_map] diff --git a/samples/webgl-tilt-rotation/index.ts b/samples/webgl-tilt-rotation/index.ts index 5f075ea074..5c13689f5b 100644 --- a/samples/webgl-tilt-rotation/index.ts +++ b/samples/webgl-tilt-rotation/index.ts @@ -5,18 +5,20 @@ */ // [START maps_webgl_tilt_rotation] -function initMap(): void { - const map = new google.maps.Map( +async function initMap() { + const { LatLng } = await google.maps.importLibrary("core") as google.maps.CoreLibrary; + const { Map, RenderingType } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; + + const center = new LatLng(37.790211, -122.389607); // Downtown San Francisco, CA + + const map = new Map( document.getElementById("map") as HTMLElement, { - center: { - lat: 37.7893719, - lng: -122.3942, - }, - zoom: 16, - heading: 320, - tilt: 47.5, - mapId: "90f87356969d889c", + center, + zoom: 17, + heading: 280, + tilt: 67.5, + renderingType: RenderingType.VECTOR, } ); @@ -52,13 +54,9 @@ function initMap(): void { break; } }; + } -declare global { - interface Window { - initMap: () => void; - } -} -window.initMap = initMap; +initMap(); // [END maps_webgl_tilt_rotation] -export {}; +export {}; \ No newline at end of file diff --git a/samples/webgl-tilt-rotation/webgl-tilt-rotation.json b/samples/webgl-tilt-rotation/webgl-tilt-rotation.json index 6b2f7c63b8..607477ab34 100644 --- a/samples/webgl-tilt-rotation/webgl-tilt-rotation.json +++ b/samples/webgl-tilt-rotation/webgl-tilt-rotation.json @@ -1,7 +1,6 @@ { "title": "Tilt and Rotation", - "callback": "initMap", - "libraries": [], + "dynamic_import": "true", "version": "weekly", "tag": "webgl_tilt_rotation", "name": "webgl-tilt-rotation",