Select to view content in your preferred language

Workaround to ignore a label layer when click?

4582
9
03-25-2015 10:32 AM
by Anonymous User
Not applicable

I currently have a feature layer with a click event, and a label layer drawing on top of that to label the features. If I click the feature where there is a label, that label dom node blocks the click event on the feature layer.

In my ideal world the 'disableMouseEvents()' method on an "esri/layers/LabelLayer" would also pass off click events to the layer directly beneath it. In that sense it would be transparent, but just for clicks...

Has anyone else dealt with this? My current ideas are:

- Hard code the feature layer information into a special function triggered on the label layer click

- Generalize a label layer click function, so that it does a spatial query around it for affected layers and selects the layer with the highest map index

0 Kudos
9 Replies
brianmoran_usfs
Occasional Contributor

Did you ever find a solution to this?  I'm having the same issue and it's pretty frustrating.  Thanks

0 Kudos
by Anonymous User
Not applicable

I never did, I just use small text to try and block as little of the polygon as possible 😕

thejuskambi
Frequent Contributor

Brain,

Are you using api version 3.14 or greater? if so, you should be using "setLabelingInfo"  instead of LabelLayer.

~Thejus

brianmoran_usfs
Occasional Contributor

Thanks, I am using v 3.18, and I am using the setLabelingInfo method on the feature layer.

0 Kudos
AaronNepple1
Occasional Contributor

Did any of you happen to figure out a solution for this one?

i have a feature that opens a hyperlink on click, and same thing, the label blocks the event from happening. 

Thanks,

Aaron

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

All,

   Actually this is a pretty simple css fix. All you need to do is add this css rule:

#_internal_LabelLayer_layer {
  pointer-events: none;
}
AaronNepple1
Occasional Contributor

rscheitlin‌ That did the trick!

Thank you for your help on this

0 Kudos
GianniContino
Occasional Contributor

It's really great!

Thank you!!!

0 Kudos
StéphaneGuignard
Emerging Contributor

Hi,

For information, the class name has been changed with version 3.25, the new class name is :

#labels_layer {
   pointer-events: none;
}

BR