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

Allow to change interactive option of layer #7708

Conversation

Falke-Design
Copy link
Member

@Falke-Design Falke-Design commented Oct 27, 2021

Makes it possible to toggle interactive options over setStyle.
New function setInteractive for ImageOverlay because it has no setStyle

Fix: #2669, #5442

@Falke-Design Falke-Design changed the title Allow to change interactive option of layer #2669 Allow to change interactive option of layer Oct 27, 2021
@johnd0e
Copy link
Collaborator

johnd0e commented Nov 4, 2021

There is no reliable way to change interactive option, because there may be special actions in constructor.

@johnd0e johnd0e closed this Nov 4, 2021
@Falke-Design
Copy link
Member Author

@johnd0e in which constructor? Currently we don't have special actions in one of the constructors ... Only in the onAdd & onRemove and if it can added / removed, it can be toggled too.

This is a very helpful feature which makes it possible to disable all listeners on a layer without removing them.

I would like to reopen this PR and discuss about this. @mourner do you see it like @johnd0e?

@johnd0e
Copy link
Collaborator

johnd0e commented Nov 4, 2021

in which constructor?

initialize function

Only in the onAdd & onRemove

So the option can be safely changed only when feature is not on map (in the moment of setStyle call).
Pretty useless, as for me.

@johnd0e
Copy link
Collaborator

johnd0e commented Nov 7, 2021

Imho it is better to refactor leaflet to include common extension methods like _initInteraction(true/false), and then we can implement changing of this option in any way (preferable dedicated, not setStyle).

@Falke-Design
Copy link
Member Author

@johnd0e I still think it would be useful (and working) if the interactive can changed while the layer is on the map. But it sounds like a good solution to add a general function _initInteraction(true/false) for layers. But in my eyes it would be better to make it a public function.

Btw. is it wanted that you named the function _initInteraction and not _initInteractive?

@johnd0e
Copy link
Collaborator

johnd0e commented Nov 9, 2021

setInteractive(boolean) for public method.
And _initInteraction() for it's private part (if we need it, which is not clear yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toggle Clickable
2 participants