(
container,
options = {
tracking: true,
showPaths: true
}
)
| 20 | 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/google-3d/truck.gltf'; // eslint-disable-line |
| 21 | |
| 22 | export async function renderToDOM( |
| 23 | container, |
| 24 | options = { |
| 25 | tracking: true, |
| 26 | showPaths: true |
| 27 | } |
| 28 | ) { |
| 29 | const loader = new Loader({apiKey: GOOGLE_MAPS_API_KEY}); |
| 30 | const googlemaps = await loader.importLibrary('maps'); |
| 31 | |
| 32 | const resp = await fetch(DATA_URL); |
| 33 | const data = await resp.json(); |
| 34 | |
| 35 | const map = new googlemaps.Map(container, { |
| 36 | center: {lng: -95.36403, lat: 29.756433}, |
| 37 | zoom: 19, |
| 38 | heading: 0, |
| 39 | tilt: 45, |
| 40 | isFractionalZoomEnabled: true, |
| 41 | mapId: GOOGLE_MAP_ID, |
| 42 | mapTypeControlOptions: { |
| 43 | mapTypeIds: ['roadmap', 'terrain'] |
| 44 | }, |
| 45 | streetViewControl: false |
| 46 | }); |
| 47 | |
| 48 | const overlay = new DeckOverlay({}); |
| 49 | overlay.setMap(map); |
| 50 | |
| 51 | const stopAnimation = startAnimation(map, overlay, data, options); |
| 52 | |
| 53 | return { |
| 54 | update: newOpts => Object.assign(options, newOpts), |
| 55 | remove: () => { |
| 56 | stopAnimation(); |
| 57 | overlay.finalize(); |
| 58 | } |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | function startAnimation(map, overlay, data, options) { |
| 63 | const trips = data.map(waypoints => new TripBuilder({waypoints, loop: true})); |
nothing calls this directly
no test coverage detected
searching dependent graphs…