Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct return type for ol/layer/VectorTile~getFeatures() #14165

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

MoonE
Copy link
Contributor

@MoonE MoonE commented Oct 3, 2022

ol/layer/VectorTile may also return ol/render/Feature. Currently the return type is always ol/Feature.

@github-actions
Copy link

github-actions bot commented Oct 3, 2022

📦 Preview the website for this branch here: https://deploy-preview-14165--ol-site.netlify.app/.

@@ -192,5 +193,5 @@ export function hitDetect(pixel, features, imageData) {
resultFeatures.push(features[i / indexFactor - 1]);
}
}
return resultFeatures;
return /** @type {Array<F>} */ (resultFeatures);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why it doesn't work without this cast. Its simply copying features from the input array to the returned array ....

return accumulator.concat(sourceTile.getFeatures());
}, []);
let hitDetectionImageData = tile.hitDetectionImageData[layerUid];
if (!hitDetectionImageData && !this.animatingOrInteracting_) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.animatingOrInteracting_ does not exist in ol/renderer/canvas/VectorTileLayer, so I removed it. Should be ok to ignore interactions as the hitdetect image is per tile. Not sure about animations.

@MoonE MoonE merged commit 35eef85 into openlayers:main Oct 4, 2022
@MoonE MoonE deleted the hitdetect-type branch October 4, 2022 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants