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

Toggle Clickable #2669

Closed
eborden opened this issue May 5, 2014 · 6 comments
Closed

Toggle Clickable #2669

eborden opened this issue May 5, 2014 · 6 comments

Comments

@eborden
Copy link

eborden commented May 5, 2014

There is no ability to toggle the clickable state of a marker/layer. You can toggle dragging on/off, but clickable has no such feature.

@dwilhelm89
Copy link
Contributor

You could simply add/remove your click handler to toggle the clickable state.

var clickFunction = function(){
    console.log('click');
}
map.on('click', clickFunction);
map.off('click', clickFunction);

@eborden
Copy link
Author

eborden commented May 11, 2014

That is a partial solution and what I'm doing right now. The problem is that a clickable marker remains "clickable" even if it does not have any events attached to it. It does not become part of the scenery and still displays on hover cursor changes implying click-ability. Yes there are solutions to this, but removing and adding events and forcibly changing cursor states are heavy handed solutions to what could be a simple api call.

@mourner
Copy link
Member

mourner commented May 26, 2014

This is a good point. I think we should rename clickable to interactive and add it as a handler as well.

@mourner mourner added this to the post-1.0-beta milestone May 26, 2014
@mourner mourner self-assigned this May 26, 2014
@knownasilya
Copy link

@eborden totally agree with you. It's totally a pain (wasted a good hour trying to figure out the issue - _initInteractive called only once, so subsequent changes to options.clickable are futile, and even if you call _initInteractive it doesn't help if you've set clickable to false), and requires getting the underlying DOM elements, setting a custom class to disable the cursor, and handling the clickable in the handler, definitely not the best approach. Seems like clickable and draggable both need some love.

@francis-shuoch
Copy link
Contributor

is there anyone working on this? I think I can refactor this part ;)

@johnd0e
Copy link
Collaborator

johnd0e commented Nov 9, 2021

Closed in favor of #5442

@johnd0e johnd0e closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants