Skip to content

Commit c4baeb2

Browse files
committed
hover, unhover
1 parent 53c7c11 commit c4baeb2

File tree

3 files changed

+86
-729
lines changed

3 files changed

+86
-729
lines changed

src/plots/gl2d/scene2d.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,21 @@ proto.draw = function() {
522522
glplot.pixelRatio
523523
];
524524

525+
// this needs to happen before the next block that deletes traceCoord data
526+
// also it's important to copy, otherwise data is lost by the time event data is read
527+
this.graphDiv.emit('plotly_hover', {
528+
points: [{
529+
trace: nextSelection.trace,
530+
dataCoord: nextSelection.dataCoord.slice(),
531+
traceCoord: nextSelection.traceCoord.slice(),
532+
textLabel: nextSelection.textLabel,
533+
color: nextSelection.color,
534+
name: nextSelection.name,
535+
hoverinfo: nextSelection.hoverinfo,
536+
screenCoord: nextSelection.screenCoord.slice()
537+
}]
538+
});
539+
525540
var hoverinfo = selection.hoverinfo;
526541
if(hoverinfo !== 'all') {
527542
var parts = hoverinfo.split('+');
@@ -549,6 +564,7 @@ proto.draw = function() {
549564
else if(!result && this.lastPickResult) {
550565
this.spikes.update({});
551566
this.lastPickResult = null;
567+
this.graphDiv.emit('plotly_unhover');
552568
Fx.loneUnhover(this.svgContainer);
553569
}
554570
}

test/jasmine/assets/hover.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var mouseEvent = require('./mouse_event');
2+
3+
module.exports = function hover(x, y) {
4+
mouseEvent('mousemove', x, y);
5+
};

0 commit comments

Comments
 (0)