mirror of https://gitee.com/antv-l7/antv-l7
fix: 修复拾取高亮状态异常 (#1368)
* fix: 修复 featureScale 错误 * style: lint style * fix: remove featureScalePlugin async * fix: 修复拾取高亮状态异常 Co-authored-by: shihui <yiqianyao.yqy@alibaba-inc.com>
This commit is contained in:
parent
3afb611745
commit
d74957a902
|
@ -34,49 +34,9 @@ export default () => {
|
|||
type: "Polygon",
|
||||
coordinates: [
|
||||
[
|
||||
[113.8623046875, 31.031055426540206],
|
||||
[116.3232421875, 32.031055426540206],
|
||||
[116.3232421875, 32.590574094954192]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "Feature",
|
||||
properties: {
|
||||
color: "#ff0",
|
||||
name: "北京"
|
||||
},
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: [
|
||||
[
|
||||
[111.8623046875, 30.031055426540206],
|
||||
[112.3232421875, 30.031055426540206],
|
||||
[113.3232421875, 31.090574094954192]
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const geo2 = {
|
||||
type: "FeatureCollection",
|
||||
features: [
|
||||
{
|
||||
type: "Feature",
|
||||
properties: {
|
||||
color: "#f00",
|
||||
name: "杭州"
|
||||
},
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: [
|
||||
[
|
||||
[113.8623046875, 31.031055426540206],
|
||||
[116.3232421875, 32.031055426540206],
|
||||
[116.3232421875, 32.590574094954192]
|
||||
[100, 30],
|
||||
[120, 35],
|
||||
[120, 30]
|
||||
]
|
||||
]
|
||||
}
|
||||
|
@ -85,35 +45,18 @@ export default () => {
|
|||
};
|
||||
|
||||
const layer = new PolygonLayer()
|
||||
.source(geo, {
|
||||
transforms: [
|
||||
{
|
||||
type: "join",
|
||||
sourceField: "name", //data1 对应字段名
|
||||
targetField: "name", // data 对应字段名 绑定到的地理数据
|
||||
data: dataList
|
||||
}
|
||||
]
|
||||
})
|
||||
.source(geo)
|
||||
.shape("fill")
|
||||
.color("data", (c) => c)
|
||||
.color("#f00")
|
||||
// .active(true)
|
||||
.select(true)
|
||||
|
||||
scene.on("loaded", () => {
|
||||
scene.addLayer(layer);
|
||||
|
||||
setTimeout(() => {
|
||||
layer.setData(geo2, {
|
||||
transforms: [
|
||||
{
|
||||
type: "join",
|
||||
sourceField: "name", //data1 对应字段名
|
||||
targetField: "name", // data 对应字段名 绑定到的地理数据
|
||||
data: dataList2
|
||||
}
|
||||
]
|
||||
})
|
||||
.color("data", (c) => c);
|
||||
}, 2000);
|
||||
layer.on('mousemove', () => {
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
}, []);
|
||||
|
|
|
@ -43,9 +43,6 @@ export default class PickingService implements IPickingService {
|
|||
|
||||
private pickBufferScale: number = 1.0;
|
||||
|
||||
// Tip: 记录当前拾取中的 layers
|
||||
private pickedLayers: ILayer[] = [];
|
||||
|
||||
public init(id: string) {
|
||||
const {
|
||||
createTexture2D,
|
||||
|
@ -252,7 +249,6 @@ export default class PickingService implements IPickingService {
|
|||
// trigger onHover/Click callback on layer
|
||||
isPicked = true;
|
||||
layer.setCurrentPickId(pickedFeatureIdx);
|
||||
this.pickedLayers = [layer];
|
||||
this.triggerHoverOnLayer(layer, layerTarget); // 触发拾取事件
|
||||
}
|
||||
} else {
|
||||
|
@ -275,7 +271,6 @@ export default class PickingService implements IPickingService {
|
|||
});
|
||||
this.triggerHoverOnLayer(layer, layerTarget);
|
||||
layer.setCurrentPickId(null);
|
||||
this.pickedLayers = [];
|
||||
}
|
||||
|
||||
if (enableHighlight) {
|
||||
|
@ -382,12 +377,6 @@ export default class PickingService implements IPickingService {
|
|||
depth: 1,
|
||||
});
|
||||
|
||||
// Tip: clear last picked layer state
|
||||
this.pickedLayers
|
||||
.filter((pickedlayer) => !pickedlayer.isVector)
|
||||
.map((pickedlayer) => {
|
||||
this.selectFeature(pickedlayer, new Uint8Array([0, 0, 0, 0]));
|
||||
});
|
||||
// Tip: clear last picked tilelayer state
|
||||
this.pickedTileLayers.map((pickedTileLayer) =>
|
||||
(pickedTileLayer.tileLayer as ITileLayer)?.clearPick(target.type),
|
||||
|
|
Loading…
Reference in New Issue