@tianditu/wc
Version:
Web components for tianditu, powered by Demo Macro.
102 lines (101 loc) • 3.12 kB
JavaScript
/*!
* MIT © Demo Macro
*/
import { Host, h } from "@stencil/core";
import { onload } from "../../utils/use";
export class TdtControlScale {
constructor() {
this.position = "bottomleft";
this.color = undefined;
this.uniqueId = undefined;
this.control = undefined;
this.map = undefined;
}
connectedCallback() {
onload(() => {
this.map = globalThis[this.uniqueId];
this.control = new T.Control.Scale({
position: this.position,
});
this.map.addControl(this.control);
});
}
componentWillRender() {
onload(() => {
this.color && this.control.setColor(this.color);
});
}
render() {
return (h(Host, { key: '8aadccd6ea8ebf1f0f26bd22e64b45e5555c1f29' }, h("slot", { key: 'e71e4d337a9c1de44b13eb205767e3ad6c122f06' })));
}
static get is() { return "tdt-control-scale"; }
static get encapsulation() { return "shadow"; }
static get properties() {
return {
"position": {
"type": "string",
"mutable": false,
"complexType": {
"original": "T.ControlPosition",
"resolved": "\"bottomleft\" | \"bottomright\" | \"topleft\" | \"topright\"",
"references": {
"T": {
"location": "global",
"id": "global::T"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "position",
"reflect": true,
"defaultValue": "\"bottomleft\""
},
"color": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
},
"attribute": "color",
"reflect": true
},
"uniqueId": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": true,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "unique-id",
"reflect": true
}
};
}
static get states() {
return {
"control": {},
"map": {}
};
}
}
//# sourceMappingURL=tdt-control-scale.js.map