UNPKG

@tianditu/wc

Version:

Web components for tianditu, powered by Demo Macro.

52 lines (47 loc) 1.78 kB
/*! * MIT © Demo Macro */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const index = require('./index-75a53569.js'); const TdtMap = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.tk = undefined; this.projection = undefined; this.minZoom = undefined; this.maxZoom = undefined; this.maxBounds = undefined; this.center = [0, 0]; this.zoom = undefined; this.uniqueId = Math.random().toString(36).slice(2); this.map = undefined; } connectedCallback() { this.el.style.display = "block"; this.el.style.height = "100%"; this.el.style.width = "100%"; globalThis.onload = () => { this.map = new T.Map(this.el, { projection: this.projection, minZoom: this.minZoom, maxZoom: this.maxZoom, maxBounds: this.maxBounds, center: new T.LngLat(this.center[0], this.center[1]), zoom: this.zoom, }); this.map.centerAndZoom(new T.LngLat(this.center[0], this.center[1]), this.zoom || 18); globalThis[this.uniqueId] = this.map; const childElements = this.el.querySelectorAll("*"); for (let i = 0; i < childElements.length; i++) { childElements[i].setAttribute("unique-id", this.uniqueId); } }; } render() { return (index.h(index.Host, { key: '7bda253b550567a77b4ab9f9abd5ebb8a2a0eaa9' }, index.h("slot", { key: '9128ed9a8daaaa176958b8b702d945ed44598d32' }))); } get el() { return index.getElement(this); } }; exports.tdt_map = TdtMap; //# sourceMappingURL=tdt-map.cjs.entry.js.map