I am using a style function to style a vector layer with text labels. For the text style I have set overflow to true so that labels can exceed the dimensions of a polygon.

I now want to use another style function when hovering the features to give them another style. Therefore I am using a select interaction with pointermove condition. Hovering and styling the features works like expected. The only major problem is that hovering the overlapping labels also triggers the interaction. This leads to ugly flickering because each time I hit a letter the style gets applied, each time I hit a blank between the letters, the style gets removed.

How can I differentiate between the actual features and the texts when hovering?

  • It's probably going to need a workaround such as unselectable feature with label and duplicate selectable feature without label, and use the interaction's on select event to synchronise styles if necessary. – Mike Oct 7 '18 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.