mirror of https://gitee.com/antv-l7/antv-l7
fix: layer 拾取 fix #191
This commit is contained in:
parent
2e8e54727b
commit
9c7d9e902c
|
@ -209,18 +209,18 @@ export default class PixelPickingPass<
|
|||
this.triggerHoverOnLayer(target);
|
||||
this.layer.setCurrentPickId(null);
|
||||
}
|
||||
});
|
||||
|
||||
if (enableHighlight) {
|
||||
this.highlightPickedFeature(pickedColors);
|
||||
}
|
||||
if (
|
||||
enableSelect &&
|
||||
type === 'click' &&
|
||||
pickedColors?.toString() !== [0, 0, 0, 0].toString()
|
||||
) {
|
||||
this.selectFeature(pickedColors);
|
||||
}
|
||||
if (enableHighlight) {
|
||||
this.highlightPickedFeature(pickedColors);
|
||||
}
|
||||
if (
|
||||
enableSelect &&
|
||||
type === 'click' &&
|
||||
pickedColors?.toString() !== [0, 0, 0, 0].toString()
|
||||
) {
|
||||
this.selectFeature(pickedColors);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
private triggerHoverOnLayer(target: {
|
||||
|
|
|
@ -49,9 +49,7 @@ export default class PixelPickingPlugin implements ILayerPlugin {
|
|||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
||||
// 只有开启拾取才需要 encode
|
||||
const { id } = feature;
|
||||
return enablePicking && layer.isVisible()
|
||||
? encodePickingColor(id as number)
|
||||
: [0, 0, 0];
|
||||
return enablePicking ? encodePickingColor(id as number) : [0, 0, 0];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -48,6 +48,9 @@ export default class LineDemo extends React.Component {
|
|||
opacity: 1.0,
|
||||
});
|
||||
|
||||
lineLayer.on('click',(e)=> {
|
||||
console.log(e);
|
||||
})
|
||||
scene.addLayer(lineLayer);
|
||||
this.scene = scene;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue