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

Add modebar buttons control into layout #5623

Closed
nicolaskruchten opened this issue May 4, 2021 · 7 comments · Fixed by #5660
Closed

Add modebar buttons control into layout #5623

nicolaskruchten opened this issue May 4, 2021 · 7 comments · Fixed by #5660
Labels
feature something new
Milestone

Comments

@nicolaskruchten
Copy link
Contributor

nicolaskruchten commented May 4, 2021

Let's add a layout.modebar.buttons = {add: [...], remove: [...] } attribute to make it easier for folks to force certain buttons (like the to-be-removed hovermode buttons per #5642 or the drawing controls)

@nicolaskruchten
Copy link
Contributor Author

nicolaskruchten commented May 6, 2021

and change hovermode to closest -> #5639

@nicolaskruchten
Copy link
Contributor Author

nicolaskruchten commented May 7, 2021

So to crisp up a bit what I think should happen in layout... We should add a new key modebar.buttons which accepts an object with keys add and remove, which should in turn accept arrays of strings. These attributes should behave the same way as the existing config keys modebarButtonsToAdd (in array-of-strings mode only!) and modebarButtonsToRemove (i.e. they should follow the same precedence rules we have right now in config, whatever they are).

The config should take precedence over whatever is set in the layout, so if the layout adds a button and the config removes it, it should be removed.

@nicolaskruchten
Copy link
Contributor Author

(updated above to reflect the fact that we already have layout.modebar ... should this be layout.modebar.buttons.(add|remove) or layout.modebar.(buttonstoadd|buttonstoremove) ?

@nicolaskruchten nicolaskruchten changed the title Move modebarbuttons control into layout Add modebar buttons control into layout May 7, 2021
@archmoj archmoj added the feature something new label May 9, 2021
@archmoj
Copy link
Contributor

archmoj commented May 10, 2021

The config should take precedence over whatever is set in the layout, so if the layout adds a button and the config removes it, it should be removed.

Hmm... shouldn't layout win over config?

@nicolaskruchten
Copy link
Contributor Author

No, config should still win IMO

@alexcjohnson
Copy link
Collaborator

At some point we may want to expose an equivalent of config.modebarButtons, which would be most natural as layout.modebar.buttons = ["zoom", "pan", ...]

layout.modebar.buttons.(add|remove) is incompatible with that, unless we do something like buttons.(add|remove|all).

layout.modebar.(buttonstoadd|buttonstoremove) feels a bit long though. Would it be ambiguous to just use layout.modebar.(add|remove)?

@nicolaskruchten
Copy link
Contributor Author

OK for layout.modebar.(add|remove). I don't want to go down the road of .buttons=[...] right now because I that's a very static view of things: you have to know all the current defaults to recreate "defaults+add-remove".

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

Successfully merging a pull request may close this issue.

3 participants