-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add mouse event to plotly_click
, plotly_hover
and plotly_unhover
#1505
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 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fe29404
events: plotly_click, plotly_hover, plotly_unhover
n-riesco a2488a4
events: fix plotly events in geo plots
n-riesco c56c585
events: fix plotly events in mapbox plots
n-riesco 22a9396
event: fix regression in pie interactions
n-riesco a95e1c0
events: update tests
n-riesco b0dbec3
pie: test issue #902
n-riesco e08f727
pie: emit `plotly_hover` even if hoverinfo is none
n-riesco 0d52abc
pie: test issue #1456
n-riesco f9e99f9
pie: Fix undefined trace in 'plotly_click'
n-riesco 82f1f7e
events: fix regression in Fx.hover
n-riesco 9a37276
test: add getClientPosition to assets
n-riesco 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
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
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 |
---|---|---|
|
@@ -86,6 +86,8 @@ module.exports = function plot(gd, cdpie) { | |
hasHoverData = false; | ||
|
||
function handleMouseOver(evt) { | ||
evt.originalEvent = d3.event; | ||
|
||
// in case fullLayout or fullData has changed without a replot | ||
var fullLayout2 = gd._fullLayout, | ||
trace2 = gd._fullData[trace.index], | ||
|
@@ -97,6 +99,7 @@ module.exports = function plot(gd, cdpie) { | |
// or if hover is turned off | ||
if(gd._dragging || fullLayout2.hovermode === false || | ||
hoverinfo === 'none' || hoverinfo === 'skip' || !hoverinfo) { | ||
Fx.hover(gd, evt, 'pie'); | ||
return; | ||
} | ||
|
||
|
@@ -132,7 +135,9 @@ module.exports = function plot(gd, cdpie) { | |
} | ||
|
||
function handleMouseOut(evt) { | ||
evt.originalEvent = d3.event; | ||
gd.emit('plotly_unhover', { | ||
event: d3.event, | ||
points: [evt] | ||
}); | ||
|
||
|
@@ -144,8 +149,8 @@ module.exports = function plot(gd, cdpie) { | |
|
||
function handleClick() { | ||
gd._hoverdata = [pt]; | ||
gd._hoverdata.trace = cd.trace; | ||
Fx.click(gd, { target: true }); | ||
gd._hoverdata.trace = cd0.trace; | ||
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. Nicely done 🎉 |
||
Fx.click(gd, d3.event); | ||
} | ||
|
||
slicePath.enter().append('path') | ||
|
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
var mouseEvent = require('./mouse_event'); | ||
|
||
module.exports = function click(x, y) { | ||
mouseEvent('mousemove', x, y); | ||
mouseEvent('mousedown', x, y); | ||
mouseEvent('mouseup', x, y); | ||
module.exports = function click(x, y, opts) { | ||
mouseEvent('mousemove', x, y, opts); | ||
mouseEvent('mousedown', x, y, opts); | ||
mouseEvent('mouseup', x, y, opts); | ||
mouseEvent('click', x, y, opts); | ||
}; |
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
Oops, something went wrong.
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.
Thanks!