Skip to content

Commit d61b873

Browse files
committed
call Fx.init in after marginPushers step
- to make sure that subplot nodes have the correct mouse / click handlers.
1 parent 2c04994 commit d61b873

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/plot_api/plot_api.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,16 @@ Plotly.plot = function(gd, data, layout, config) {
196196
return Plots.previousPromises(gd);
197197
}
198198

199+
// in case the margins changed, draw margin pushers again
199200
function marginPushersAgain() {
200-
// in case the margins changed, draw margin pushers again
201201
var seq = JSON.stringify(fullLayout._size) === oldmargins ?
202202
[] :
203203
[marginPushers, subroutines.layoutStyles];
204204

205+
// re-initialize cartesian interaction,
206+
// which are sometimes cleared during marginPushers
207+
seq = seq.concat(Fx.init);
208+
205209
return Lib.syncOrAsync(seq, gd);
206210
}
207211

test/jasmine/tests/hover_label_test.js

+17
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var Lib = require('@src/lib');
88
var createGraphDiv = require('../assets/create_graph_div');
99
var destroyGraphDiv = require('../assets/destroy_graph_div');
1010
var mouseEvent = require('../assets/mouse_event');
11+
var click = require('../assets/click');
1112
var doubleClick = require('../assets/double_click');
1213

1314
describe('hover info', function() {
@@ -630,6 +631,16 @@ describe('hover after resizing', function() {
630631

631632
afterEach(destroyGraphDiv);
632633

634+
function _click(pos) {
635+
return new Promise(function(resolve) {
636+
click(pos[0], pos[1]);
637+
638+
setTimeout(function() {
639+
resolve();
640+
}, constants.HOVERMINTIME);
641+
});
642+
}
643+
633644
function assertLabelCount(pos, cnt, msg) {
634645
return new Promise(function(resolve) {
635646
mouseEvent('mousemove', pos[0], pos[1]);
@@ -652,6 +663,12 @@ describe('hover after resizing', function() {
652663
pos1 = [401, 122];
653664

654665
Plotly.plot(gd, data, layout).then(function() {
666+
667+
// to test https://github.com/plotly/plotly.js/issues/1044
668+
669+
return _click(pos0);
670+
})
671+
.then(function() {
655672
return assertLabelCount(pos0, 1, 'before resize, showing pt label');
656673
})
657674
.then(function() {

0 commit comments

Comments
 (0)