waibu-maps
Version:
Maps for Waibu MPA
27 lines (22 loc) • 853 B
JavaScript
import control from './control.js'
async function controlGlobe () {
const WmapsControl = await control.call(this)
return class WmapsControlFullscreen extends WmapsControl {
constructor (options) {
super(options)
this.params.noTag = true
}
build = async () => {
const { jsonStringify } = this.app.waibuMpa
const { isString } = this.app.lib._
const opts = {}
if (isString(this.params.attr.container)) opts.container = this.params.attr.container
opts.position = this.ctrlPos.includes(this.params.attr.position) ? this.params.attr.position : 'bottom-right'
this.addBlock('mapStyle', `
await wmaps.createControlNative('GlobeControl', ${jsonStringify(opts, true)})
`)
this.params.html = this.writeBlock()
}
}
}
export default controlGlobe