| 27 | |
| 28 | // Create canvas elements for map and deck |
| 29 | function createCanvas(props: DeckGLInternalProps) { |
| 30 | let { container = document.body } = props; |
| 31 | |
| 32 | if (typeof container === 'string') { |
| 33 | container = document.getElementById(container); |
| 34 | } |
| 35 | |
| 36 | if (!container) { |
| 37 | throw Error('Deck: container not found'); |
| 38 | } |
| 39 | |
| 40 | // Add DOM elements |
| 41 | const containerStyle = window.getComputedStyle(container); |
| 42 | if (containerStyle.position === 'static') { |
| 43 | container.style.position = 'relative'; |
| 44 | } |
| 45 | |
| 46 | const deckCanvas = document.createElement('canvas'); |
| 47 | container.appendChild(deckCanvas); |
| 48 | Object.assign(deckCanvas.style, CANVAS_STYLE); |
| 49 | |
| 50 | return { container, deckCanvas }; |
| 51 | } |
| 52 | |
| 53 | export interface DeckGLClassesForPresenter { |
| 54 | OrbitControllerClass: typeof OrbitController_Class; |