-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Issue 578 (keep legend scrollbar position after toggle) #584
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
Issue 578 (keep legend scrollbar position after toggle) #584
Conversation
* Only set the scrollbar position during first render. * Only register the wheel and drag listeners during first render. * If the scrollbar is to be shown, ensure only the expanded scrollbox is drawn. Fixes plotly#578
In commit 8f05316, you mentioned
This can't be just on first render. Consider, this case: // in the test dashboard console
Tabs.plotMock('legend_scroll');
// then
var gd = Tabs.getGraph();
Plotly.relayout(gd, 'showlegend', false);
// then
Plotly.relayout(gd, 'showlegend', true); leads to an un-scrollable legend. So, I think you'll need to relax the on-first-render requirement to something like every time the legend group enter selection is non-empty. |
@etpinard OK, I'll fix that and add a test for it. |
* Tested that event listeners in a legend work after hiding and showing back the legend.
PR is ready for review again. |
@n-riesco getting there, but looks like the scroll bar does not appear after a Scrolling works though and makes the scroll bar appear. |
@etpinard Well, finally the penny dropped! And I understood that it makes more sense to use the legend enter selection as you suggested. BTW, what did you use to create the gif? |
@@ -122,7 +119,8 @@ module.exports = function draw(gd) { | |||
.call(setupTraceToggle, gd); | |||
}); | |||
|
|||
if(gd.firstRender) { | |||
var firstRender = legend.enter().size() !== 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicely done.
I'm using this |
Great PR. Thanks @n-riesco |
This works great. Thanks @n-riesco ! |
No description provided.