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.triggerHoverOnLayer(target);
|
||||||
this.layer.setCurrentPickId(null);
|
this.layer.setCurrentPickId(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (enableHighlight) {
|
if (enableHighlight) {
|
||||||
this.highlightPickedFeature(pickedColors);
|
this.highlightPickedFeature(pickedColors);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
enableSelect &&
|
enableSelect &&
|
||||||
type === 'click' &&
|
type === 'click' &&
|
||||||
pickedColors?.toString() !== [0, 0, 0, 0].toString()
|
pickedColors?.toString() !== [0, 0, 0, 0].toString()
|
||||||
) {
|
) {
|
||||||
this.selectFeature(pickedColors);
|
this.selectFeature(pickedColors);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
private triggerHoverOnLayer(target: {
|
private triggerHoverOnLayer(target: {
|
||||||
|
|
|
@ -49,9 +49,7 @@ export default class PixelPickingPlugin implements ILayerPlugin {
|
||||||
update: (feature: IEncodeFeature, featureIdx: number) => {
|
update: (feature: IEncodeFeature, featureIdx: number) => {
|
||||||
// 只有开启拾取才需要 encode
|
// 只有开启拾取才需要 encode
|
||||||
const { id } = feature;
|
const { id } = feature;
|
||||||
return enablePicking && layer.isVisible()
|
return enablePicking ? encodePickingColor(id as number) : [0, 0, 0];
|
||||||
? encodePickingColor(id as number)
|
|
||||||
: [0, 0, 0];
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,6 +48,9 @@ export default class LineDemo extends React.Component {
|
||||||
opacity: 1.0,
|
opacity: 1.0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lineLayer.on('click',(e)=> {
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
scene.addLayer(lineLayer);
|
scene.addLayer(lineLayer);
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue