-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix ternary hover after zoom/pan events #688
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3b1ee6b
fix ternary hover after zoom/pan events
alexcjohnson ab3a9a2
Tests: pull click and doubleClick out into assets
alexcjohnson cda7f6c
appease eslint
alexcjohnson c45c074
hover on fills: constrain label to cartesian and ternary viewports
alexcjohnson a0a12d8
test clipped positioning of hover labels for scatterternary fill
alexcjohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var mouseEvent = require('./mouse_event'); | ||
|
||
module.exports = function click(x, y) { | ||
mouseEvent('mousemove', x, y); | ||
mouseEvent('mousedown', x, y); | ||
mouseEvent('mouseup', x, y); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var click = require('./click'); | ||
var DBLCLICKDELAY = require('@src/plots/cartesian/constants').DBLCLICKDELAY; | ||
|
||
module.exports = function doubleClick(x, y) { | ||
return new Promise(function(resolve) { | ||
click(x, y); | ||
|
||
setTimeout(function() { | ||
click(x, y); | ||
setTimeout(function() { resolve(); }, DBLCLICKDELAY / 2); | ||
}, DBLCLICKDELAY / 2); | ||
}); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ var d3 = require('d3'); | |
var Plotly = require('@lib/index'); | ||
var Lib = require('@src/lib'); | ||
var DBLCLICKDELAY = require('@src/plots/cartesian/constants').DBLCLICKDELAY; | ||
var click = require('../assets/click'); | ||
var doubleClick = require('../assets/double_click'); | ||
|
||
var createGraphDiv = require('../assets/create_graph_div'); | ||
var destroyGraphDiv = require('../assets/destroy_graph_div'); | ||
|
@@ -35,23 +37,6 @@ describe('select box and lasso', function() { | |
mouseEvent('mouseup', path[len - 1][0], path[len - 1][1]); | ||
} | ||
|
||
// cartesian click events events use the hover data | ||
// from the mousemove events and then simulate | ||
// a click event on mouseup | ||
function click(x, y) { | ||
mouseEvent('mousemove', x, y); | ||
mouseEvent('mousedown', x, y); | ||
mouseEvent('mouseup', x, y); | ||
} | ||
|
||
function doubleClick(x, y, cb) { | ||
click(x, y); | ||
setTimeout(function() { | ||
click(x, y); | ||
cb(); | ||
}, DBLCLICKDELAY / 2); | ||
} | ||
|
||
function assertRange(actual, expected) { | ||
var PRECISION = 4; | ||
|
||
|
@@ -104,7 +89,7 @@ describe('select box and lasso', function() { | |
|
||
drag([[x0, y0], [x1, y1]]); | ||
|
||
doubleClick(x2, y2, done); | ||
doubleClick(x2, y2).then(done); | ||
}); | ||
}); | ||
|
||
|
@@ -153,7 +138,7 @@ describe('select box and lasso', function() { | |
|
||
drag([[x0, y0], [x1, y1]]); | ||
|
||
doubleClick(x2, y2, done); | ||
doubleClick(x2, y2).then(done); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. much better. 🎉 |
||
}); | ||
}); | ||
|
||
|
@@ -225,7 +210,7 @@ describe('select box and lasso', function() { | |
y: [0.10209191961595454, 24.512223978291406] | ||
}, 'with the correct selected range'); | ||
|
||
doubleClick(250, 200, function() { | ||
doubleClick(250, 200).then(function() { | ||
expect(doubleClickData).toBe(null, 'with the correct deselect data'); | ||
done(); | ||
}); | ||
|
@@ -283,7 +268,7 @@ describe('select box and lasso', function() { | |
y: 2.75 | ||
}], 'with the correct selected points'); | ||
|
||
doubleClick(250, 200, function() { | ||
doubleClick(250, 200).then(function() { | ||
expect(doubleClickData).toBe(null, 'with the correct deselect data'); | ||
done(); | ||
}); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fantastic. Thanks so much!