-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Non scaling stroke on zoom. #760
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
Comments
Correct me if I'm wrong, is it's not (reasonably) possible to apply that to markers, is it? Just paths? Or you can use actual markers but then they all have to be the same etc. so that for plotly this can really only be used on paths? |
As far as I know, it only works on paths. We could counteract marker size changes easily enough as well though - just need to set |
SVG elements get redrawn all the time, so not sure there's a meaningful performance overhead to scaling points if the transform is just computed to a string once and applied a bunch—thought it's a bit ugly. Added |
Is this the spot for it? https://github.com/plotly/plotly.js/blob/master/src/components/drawing/index.js#L84 |
I think that would do it - I was testing in |
Pardon the hacky informality, but deployed a quick PoC with it added on that line here: https://rreusser.github.io/plotly-expression-transform/ that is, drawing.lineGroupStyle = function(s, lw, lc, ld) {
s.style('fill', 'none')
.style('vector-effect', 'non-scaling-stroke')
.each(function(d) { A grep shows it's used in the following places:
|
None of the other uses include transforms on the parent, I think, so I think it's relatively innocuous based on current usage. (Too bad point scaling can't be handled in parallel though.) Although maybe it is better to scope it to scatter (and contour?) traces though… If it's not used elsewhere then it's not really necessary to set it elsewhere, even if it has no effect. |
This only applies when using
zoomScroll
, but we should addvector-effect="non-scaling-stroke"
to scatter lines so they don't embiggen and enshrinken too too much.E.g. when scrolling on @rreusser 's example here
The text was updated successfully, but these errors were encountered: