Hello, I tried this example vtk.js. I call the method by click event, but not every click will trigger, even if I click the point.
document.addEventListener('mousedown', (event) => {
const [x, y] = eventToWindowXY(event);
hardwareSelector.getSourceDataAsync(renderer, x, y, x, y).then((result) => {
console.log(result);
if (result) {
processSelections(result.generateSelection(x, y, x, y));
} else {
processSelections(null);
}
});
});
function processSelections(selections) {
if (!selections || selections.length === 0) {
return;
}
const {
worldPosition: rayHitWorldPosition,
compositeID,
prop,
propID,
attributeID,
} = selections[0].getProperties();
console.log(selections);
console.log(selections[0].getProperties());
console.log(hardwareSelector.getFieldAssociation());
if (hardwareSelector.getFieldAssociation() === FieldAssociations.FIELD_ASSOCIATION_POINTS) {
// Selecting points
console.log('attributeID', attributeID);
}
renderWindow.render();
}
Can you help me see why this happens?