-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
WIP: Legend Scrolling #243
Conversation
.call(Plotly.Drawing.setRect, borderwidth/2, borderwidth/2, | ||
legendwidth-borderwidth, legendheight-borderwidth); | ||
|
||
var legendsvg = fullLayout._infolayer.selectAll('svg.legend'), |
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.
This section should likely be moved to the draw
step, but everything is highly coupled right now and the order of drawing/sizing/positioning is very scattered.
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.
@mdtusz Any reason for putting this section in repostionLegend
in the first place?
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.
Mainly for ease of development. The scroll handler requires the final height of the legend to calculate the viewbox offset and at the time, I was still trying to wrap my head around the control flow in here.
It will be moved out into draw
before we merge though
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.
thanks for the info. 👍
@mdtusz This PR is looking great. To add some background info (cc @alexcjohnson @cldougl):
|
Pretty nice that this is dynamically computed now even cooler it will be configurable in the future 🎆 |
91a68b5
to
811f925
Compare
Can we get away from adding another nested svg, and do it with |
I'm not sure the best way how we could easily do this with a clip path - the reason it works now is because of the shifting viewBox. As far as I understand, with a clip-path, we'd need to have the clip-path coordinates shift, as well as an opposing shift of the element containing the legend items. I.e. legend items moves up while clip-path on it moves down to make the apparent legend box look stationary. This could/would work, but I imagine the scrolling would appear janky because of the moving outer element - having the movements be perfectly in sync would likely be hard to achieve. |
If you make a |
Not an issue here because you can do it with a single transform... but as far as I've seen, browsers will not repaint during synchronous js execution. This is in fact the primary motivation behind |
Yep, I played around and have gotten it to work using a |
I mainly wanted to avoid making the nested svg problem worse... so I won't complain if you leave it at that. But I suspect it wouldn't be that hard: Up to @jackparmer how much he wants Illustrator compatibility, people have been complaining about it forever but at a low level. |
df4d34a
to
82dbfcc
Compare
|
||
function mMove(e) { | ||
if(e.buttons === 1){ | ||
scrollHandler(e.movementY); |
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.
This felt a little a crude on my laptop.
The mouse wheel scaling is very smooth though 👍
For archival reasons, I'll mention that this PR will fix #251. |
💃 |
FINALLY! |
BOOM! 💥 On Mon, Feb 22, 2016 at 4:34 PM, Miklos Tusz notifications@github.com
|
Best thing since open sourcing plotly.js :-) 🎉 |
There's still a bug or two to work out, but it's in a working state.
When you toggle a trace for the first time, the width changes and hides the scrollbar until you scroll (for some reason the text-width is being changed when you toggle for the first time).
Otherwise, it will automatically enable the scroll if the height of the list of traces is greater than the height of the plot. I need to add a check whether the scrollbar will be inserted and rework the details on what sets the bounds, but the main logic is there.