Clickable:false not working

144 views
Skip to first unread message

Seth Miller

unread,
Aug 15, 2016, 9:00:14 AM8/15/16
to Leaflet
I have some polylines drawn on a map that should not be clickable sometimes.  I'm able to set clickable to false (and when I show the polylines in console, you can see that clickable is set to false), but they're still clickable.  Any idea what's going on?

Thanks!

Seth Miller

unread,
Aug 15, 2016, 9:11:57 AM8/15/16
to Leaflet
So here are my polylines (already drawn, I'm using Polymer):

<leaflet-polyline no-clickable="{{function()}}"></leaflet-polyline>

When the function evaluates to true, I have an observer change the clickable property of each polyline with this function:

clickableChanged: function() {
  if (this.feature) {
   this.feature.setStyle({clickable:!this.noClickable});
 };
}

The function works and it sets the property clickable to false for each polyline, but my mouse can still click on it.  Not sure what's up with it.

Thanks!

Pat Keller

unread,
Aug 16, 2016, 12:02:43 AM8/16/16
to Leaflet
You should make a fiddle with your code to help show what you are trying to do. What do you mean by "not clickable"? Should the cursor change to the pointer icon? Do you want to suppress the click events from the polygons? Something else?

Claudio Schilling

unread,
Aug 16, 2016, 10:00:04 AM8/16/16
to leafl...@googlegroups.com
You didn't state the Leaflet version you're using, but ICYMI the 'clickable' property was deprecated and substituted by 'interactive' due to the adoption of interactive layers somewhere in the time frame of release 1.0.


--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages