Skip to content

Commit bd966d8

Browse files
committed
revised fix for issue 2208
1 parent 69f250e commit bd966d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/traces/surface/convert.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ proto.getZat = function(a, b, calendar, axis) {
7070
proto.handlePick = function(selection) {
7171
if(selection.object === this.surface) {
7272

73-
var j = Math.max(Math.min(Math.floor(selection.data.index[0] / this.dataScaleX - 0.5), this.data._xlength - 1), 0);
74-
var k = Math.max(Math.min(Math.floor(selection.data.index[1] / this.dataScaleY - 0.5), this.data._ylength - 1), 0);
73+
var xRatio = (selection.data.index[0] - 1) / this.dataScaleX - 1;
74+
var yRatio = (selection.data.index[1] - 1) / this.dataScaleY - 1;
75+
76+
var j = Math.max(Math.min(Math.round(xRatio), this.data._xlength - 1), 0);
77+
var k = Math.max(Math.min(Math.round(yRatio), this.data._ylength - 1), 0);
7578

7679
selection.index = [j, k];
7780

0 commit comments

Comments
 (0)