mirror of https://gitee.com/antv-l7/antv-l7
fix: ios 12 点击事件问题 & regl 版本锁定
This commit is contained in:
parent
ab3b639ecd
commit
cf77dbc0df
|
@ -61,6 +61,7 @@ export default class InteractionService extends EventEmitter
|
|||
// hammertime.on('panmove', this.onPanmove);
|
||||
// hammertime.on('panend', this.onPanend);
|
||||
// hammertime.on('pinch', this.onPinch);
|
||||
$containter.addEventListener('touchstart', this.onTouch);
|
||||
$containter.addEventListener('mousemove', this.onHover);
|
||||
$containter.addEventListener('click', this.onHover);
|
||||
$containter.addEventListener('mousedown', this.onHover);
|
||||
|
@ -85,6 +86,15 @@ export default class InteractionService extends EventEmitter
|
|||
$containter.removeEventListener('contextmenu', this.onHover);
|
||||
}
|
||||
}
|
||||
private onTouch = (target: TouchEvent) => {
|
||||
const touch = target.touches[0];
|
||||
// @ts-ignore
|
||||
this.onHover({
|
||||
x: touch.pageX,
|
||||
y: touch.pageY,
|
||||
type: 'touch',
|
||||
});
|
||||
};
|
||||
|
||||
private onHover = ({ x, y, type }: MouseEvent) => {
|
||||
const $containter = this.mapService.getMapContainer();
|
||||
|
@ -120,7 +130,9 @@ export default class InteractionService extends EventEmitter
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === 'touch') {
|
||||
type = 'click';
|
||||
}
|
||||
this.emit(InteractionEvent.Hover, { x, y, lngLat, type });
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
}
|
||||
#map {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}
|
||||
</style>
|
||||
<link
|
||||
|
@ -88,12 +89,16 @@
|
|||
const scene = new L7.Scene({
|
||||
id: "map",
|
||||
map: new L7.Mapbox({
|
||||
style: "dark", // 样式URL
|
||||
style: "blank", // 样式URL
|
||||
center: [ -96, 37.8 ],
|
||||
zoom: 3,
|
||||
pitch: 0,
|
||||
})
|
||||
});
|
||||
})
|
||||
scene.on('loaded',()=>{
|
||||
alert('加载完成');
|
||||
|
||||
|
||||
const color = [ 'rgb(255,255,217)', 'rgb(237,248,177)', 'rgb(199,233,180)', 'rgb(127,205,187)', 'rgb(65,182,196)', 'rgb(29,145,192)', 'rgb(34,94,168)', 'rgb(12,44,132)' ];
|
||||
const layer = new L7.PolygonLayer({})
|
||||
.source(data)
|
||||
|
@ -115,6 +120,7 @@
|
|||
opacity: 1.0
|
||||
});
|
||||
scene.addLayer(layer);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"inversify": "^5.0.1",
|
||||
"lodash": "^4.17.15",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"regl": "^1.3.11"
|
||||
"regl": "1.3.11"
|
||||
},
|
||||
"gitHead": "a5d354b66873f700730248d015c5e539c54b34b7",
|
||||
"publishConfig": {
|
||||
|
|
Loading…
Reference in New Issue