diff --git a/src/traces/contourgl/convert.js b/src/traces/contourgl/convert.js index 4d2061aa50a..8b84d72f4a1 100644 --- a/src/traces/contourgl/convert.js +++ b/src/traces/contourgl/convert.js @@ -60,20 +60,23 @@ function Contour(scene, uid) { var proto = Contour.prototype; proto.handlePick = function(pickResult) { - var index = pickResult.pointId, - options = this.heatmapOptions, - shape = options.shape; + var shape = this.options.shape, + index = pickResult.pointId, + xIndex = index % shape[0], + yIndex = Math.floor(index / shape[0]), + zIndex = index; return { trace: this, dataCoord: pickResult.dataCoord, traceCoord: [ - options.x[index % shape[0]], - options.y[Math.floor(index / shape[0])], - options.z[index] + this.options.x[xIndex], + this.options.y[yIndex], + this.options.z[zIndex] ], textLabel: this.textLabels[index], name: this.name, + pointIndex: [xIndex, yIndex, zIndex], hoverinfo: this.hoverinfo }; }; diff --git a/src/traces/heatmapgl/convert.js b/src/traces/heatmapgl/convert.js index 714073c7aae..78e192b6b2b 100644 --- a/src/traces/heatmapgl/convert.js +++ b/src/traces/heatmapgl/convert.js @@ -46,19 +46,23 @@ function Heatmap(scene, uid) { var proto = Heatmap.prototype; proto.handlePick = function(pickResult) { - var index = pickResult.pointId, - shape = this.options.shape; + var shape = this.options.shape, + index = pickResult.pointId, + xIndex = index % shape[0], + yIndex = Math.floor(index / shape[0]), + zIndex = index; return { trace: this, dataCoord: pickResult.dataCoord, traceCoord: [ - this.options.x[index % shape[0]], - this.options.y[Math.floor(index / shape[0])], - this.options.z[index] + this.options.x[xIndex], + this.options.y[yIndex], + this.options.z[zIndex] ], textLabel: this.textLabels[index], name: this.name, + pointIndex: [xIndex, yIndex, zIndex], hoverinfo: this.hoverinfo }; }; diff --git a/src/traces/pointcloud/convert.js b/src/traces/pointcloud/convert.js index 2c7374c8a14..efc86dd0f65 100644 --- a/src/traces/pointcloud/convert.js +++ b/src/traces/pointcloud/convert.js @@ -63,6 +63,7 @@ proto.handlePick = function(pickResult) { this.textLabels, color: this.color, name: this.name, + pointIndex: index, hoverinfo: this.hoverinfo }; };