-
-
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
Fix missing cursor for ternary plot #7057
Conversation
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
update as suggusted
I also updated the - if(dragmode === 'pan') {
- toplevel.style('cursor', 'move');
- } else {
- toplevel.style('cursor', 'crosshair');
- }
+ toplevel.style('cursor', dragmode === 'pan' ? 'move' : 'crosshair'); |
src/plots/ternary/ternary.js
Outdated
var toplevel = this.plotContainer.selectAll('g.toplevel'); | ||
|
||
toplevel.style('cursor', dragmode === 'pan' ? 'move' : 'crosshair'); |
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.
Let's use _ternarylayer
.
var toplevel = this.plotContainer.selectAll('g.toplevel'); | |
toplevel.style('cursor', dragmode === 'pan' ? 'move' : 'crosshair'); | |
var fullLayout = gd._fullLayout; | |
fullLayout._ternarylayer | |
.selectAll('g.toplevel') | |
.style('cursor', fullLayout.dragmode === 'pan' ? 'move' : 'crosshair'); |
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.
I have updated again with your sugguestion.
Also, I moved the updateFx
function from proto.plot
to the function Ternary(options, fullLayout)
function so that the updateFx
function is only triggered once at initialization instead of being called every time the plot is zoomed/panned and resized. What do you think?
update and clean as suggested
update and clean as suggested
src/plots/ternary/index.js
Outdated
|
||
exports.updateFx = function(gd) { | ||
var fullLayout = gd._fullLayout; | ||
|
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.
Please run npm run lint -- --fix
and commit the changes.
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.
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 PR.
💃
Fix #7056
This is my first contribution to such a large open source project. If I understand the coding style wrong or wrong logic for the fix, please let me know.