移动要素在openlayers中使用Translate类 ,但是在H5移动端不兼容,于是自己实现了下:
代码:
let flag = false
let features = null
this.$refs.rootMap.ontouchstart = (evt) => {
console.log('ontouchstart')
flag = true
features = this.interaction_select.getFeatures()
}
this.map.on('pointerdrag', (e) => {
console.log(e)
if (flag && features) {
let feature = features.getArray()[0]
feature.getGeometry().setCoordinates(e.coordinate)
}
e.preventDefault()
})
this.$refs.rootMap.ontouchend = (evt) => {
console.log('ontouchend')
flag = false
features = null
}