Fix hitdetection of icons with opacity < 1

Hit detection works by reading the pixel color, if the icon is not drawn
with full opacity it won't work.
This commit is contained in:
Maximilian Krög
2021-02-10 00:15:43 +01:00
parent 8645a3109d
commit de3f60861d

View File

@@ -81,7 +81,7 @@ export function createHitDetectionImageData(
}
style.setText(undefined);
const image = originalStyle.getImage();
if (image) {
if (image && image.getOpacity() !== 0) {
const imgSize = image.getImageSize();
if (!imgSize) {
continue;
@@ -106,8 +106,8 @@ export function createHitDetectionImageData(
anchorXUnits: IconAnchorUnits.PIXELS,
anchorYUnits: IconAnchorUnits.PIXELS,
offset: image.getOrigin(),
opacity: 1,
size: image.getSize(),
opacity: image.getOpacity(),
scale: image.getScale(),
rotation: image.getRotation(),
rotateWithView: image.getRotateWithView(),