MapLayerMouseEvent
定义于: src/ui/events.ts:439
当鼠标与地图的特定图层上的要素交互时,MapLayerMouseEvent
对象将与图层事件一起发出;
示例
map.on('click', 'states-fill', function(e) {
console.log('点击的州是:' + e.features[0].properties.name);
});
MapLayerMouseEvent
继承MapMouseEvent
的属性,同时添加以下属性:
属性
features
features: Array<MapGeoJSONFeature>
定义于: src/ui/events.ts:440
事件发生时与指针位置相交的所有要素的数组;
points
points: Array<PointLike>
定义于: src/ui/events.ts:444
每个相交要素的原始点坐标数组;对于击中线或填充的点击来说尤其有用,显示相对于它们的点击坐标;
source?
source?: string
定义于: src/ui/events.ts:448
所有相交要素的源ID;所有要素必须来自同一个源;
sourceLayer?
sourceLayer?: string
定义于: src/ui/events.ts:452
当源为矢量数据源时,所有相交要素的源图层;所有要素必须来自同一个源图层;
id?
id?: string | number
定义于: src/ui/events.ts:456
所有相交要素的ID;只有当所有要素都有相同的ID时才包含;