UNPKG

@tianditu/wc

Version:

Web components for tianditu, powered by Demo Macro.

5 lines 1.12 kB
/*! * MIT © Demo Macro */ import{r as t,h as i,H as s,g as e}from"./p-b9380f31.js";const h=class{constructor(i){t(this,i);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 t=this.el.querySelectorAll("*");for(let i=0;i<t.length;i++){t[i].setAttribute("unique-id",this.uniqueId)}}}render(){return i(s,{key:"7bda253b550567a77b4ab9f9abd5ebb8a2a0eaa9"},i("slot",{key:"9128ed9a8daaaa176958b8b702d945ed44598d32"}))}get el(){return e(this)}};export{h as tdt_map}; //# sourceMappingURL=p-1c1cab3b.entry.js.map