-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Custom mode bar buttons are displayed upside down #1335
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
Ha. Good catch. Yes, our stock mode bar icons use bottom-to-top y axis (from fontastic.me I believe) which need to be flipped in the browser. We have a few options here: 1- reverse our iconsin 2- add a general transform fieldfor example modeBarButtonsToAdd: [{
name: 'my icon',
icon: /* icon string path */,
ascent: 100,
transform: 'matrix(1 0 0 -1 0 100)',
click: function(gd) { }
}] This solution might be too confusing for some. 3- add a
|
Perhaps |
The spikeline icon required a special matrix; so maybe option 2 would be best? |
So did anyone actually get around to fixing this, or are we forced to always have a flip transform applied to custom icons whether we like it or not? |
No.
Right now, yes. But we're hoping to add an option as proposed in #1335 (comment) |
@etpinard I could do a PR to implement option 2, it looks like the most robust solution. |
The mode bar icons that ship with plotly are for some reason flipped vertically. To compensate, plotly applies transformation matrix that includes a vertical flip (the -1 in the following line):
path.setAttribute('transform', 'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')');
To illustrate: the following example of how to add a custom icon uses a SVG path that looks good, because it is actually an upside down image (I render the SVG inline for comparison): http://codepen.io/bruno-rino/pen/bgowQx
The
-1
in the transformation matrix should be configurable. Or else any normal SVG path has to be flipped manually (and I don't know even how to go about doing that) before it can be used as an icon in the mode bar.The text was updated successfully, but these errors were encountered: