MCPcopy
hub / github.com/visgl/deck.gl / renderToDOM

Function renderToDOM

examples/website/google-3d/app.js:22–60  ·  view source on GitHub ↗
(
  container,
  options = {
    tracking: true,
    showPaths: true
  }
)

Source from the content-addressed store, hash-verified

20 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/google-3d/truck.gltf'; // eslint-disable-line
21
22export 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
62function startAnimation(map, overlay, data, options) {
63 const trips = data.map(waypoints => new TripBuilder({waypoints, loop: true}));

Callers

nothing calls this directly

Calls 3

startAnimationFunction · 0.85
setMapMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…