UNPKG

@tianditu/wc

Version:

Web components for tianditu, powered by Demo Macro.

48 lines (43 loc) 1.48 kB
/*! * MIT © Demo Macro */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const index = require('./index-75a53569.js'); const use = require('./use-c678b375.js'); const TdtControl = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.control = undefined; this.position = undefined; this.visible = true; this.offset = undefined; this.options = undefined; this.uniqueId = undefined; this.map = undefined; } connectedCallback() { use.onload(() => { this.map = globalThis[this.uniqueId]; if (!this.control) { this.control = new T.Control({ position: this.position, }); } this.map.addControl(this.control); }); } componentWillRender() { use.onload(() => { this.position && this.control.setPosition(this.position); this.visible ? this.control.show() : this.control.hide(); this.offset && this.control.setOffset(this.offset); this.options && this.control.setOptions(this.options); }); } render() { return (index.h(index.Host, { key: '5d37e1f2f893daf89cb9abafb80b3067b277d28c' }, index.h("slot", { key: '9a7c7f4ea1320a1f48045b26cc9fcd170eaf8ebc' }))); } }; exports.tdt_control = TdtControl; //# sourceMappingURL=tdt-control.cjs.entry.js.map