in src/lib/components/molecules/canvas-map/lib/Map.js [25:74]
constructor(config) {
if (config.debug) {
// eslint-disable-next-line no-console
console.log("Map config", config)
}
this.allowZoomPan = config.allowZoomPan
this.options = config
this.view = new View(config.view, config.debug)
this.target = config.target
this.layers = []
// Create event dispatcher
this.dispatcher = new Dispatcher(this)
const createViewport = () => {
this._viewport = document.createElement("div")
this._viewport.className = "gv-map"
this._viewport.style.position = "relative"
this._viewport.style.overflow = "hidden"
this._viewport.style.width = "100%"
this._viewport.style.height = "100%"
this.target.appendChild(this._viewport)
// Show help text when single touch moved
this._viewport.addEventListener("touchmove", (event) => {
if (
event.targetTouches.length < 2 &&
this._collaborativeGesturesEnabled
) {
this._filterEventCallback(true)
}
})
// Create resize observer
this._resizeObserver = new ResizeObserver(() => {
this._updateSize()
})
// Trigger fires when observer is first added, ensuring _updateSize() is called
this._resizeObserver.observe(this.target)
}
// Create container div and add to viewport
if (this.target) createViewport()
// Create renderer
this._renderer = new MapRenderer(this)
}