@tianditu/wc
Version:
Web components for tianditu, powered by Demo Macro.
44 lines (41 loc) • 1.4 kB
JavaScript
/*!
* MIT © Demo Macro
*/
import { r as registerInstance, h, H as Host } from './index-0cd9c6b6.js';
import { o as onload } from './use-ccb66c1b.js';
const TdtControl = class {
constructor(hostRef) {
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() {
onload(() => {
this.map = globalThis[this.uniqueId];
if (!this.control) {
this.control = new T.Control({
position: this.position,
});
}
this.map.addControl(this.control);
});
}
componentWillRender() {
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 (h(Host, { key: '5d37e1f2f893daf89cb9abafb80b3067b277d28c' }, h("slot", { key: '9a7c7f4ea1320a1f48045b26cc9fcd170eaf8ebc' })));
}
};
export { TdtControl as tdt_control };
//# sourceMappingURL=tdt-control.entry.js.map