Skip to content

Commit e78c2c0

Browse files
committed
PR feedback - cover the other gl2d plot types
1 parent 9f77c11 commit e78c2c0

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/traces/contourgl/convert.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,23 @@ function Contour(scene, uid) {
6060
var proto = Contour.prototype;
6161

6262
proto.handlePick = function(pickResult) {
63-
var index = pickResult.pointId,
64-
options = this.heatmapOptions,
65-
shape = options.shape;
63+
var shape = this.options.shape,
64+
index = pickResult.pointId,
65+
xIndex = index % shape[0],
66+
yIndex = Math.floor(index / shape[0]),
67+
zIndex = index;
6668

6769
return {
6870
trace: this,
6971
dataCoord: pickResult.dataCoord,
7072
traceCoord: [
71-
options.x[index % shape[0]],
72-
options.y[Math.floor(index / shape[0])],
73-
options.z[index]
73+
this.options.x[xIndex],
74+
this.options.y[yIndex],
75+
this.options.z[zIndex]
7476
],
7577
textLabel: this.textLabels[index],
7678
name: this.name,
79+
pointIndex: [xIndex, yIndex, zIndex],
7780
hoverinfo: this.hoverinfo
7881
};
7982
};

src/traces/heatmapgl/convert.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,23 @@ function Heatmap(scene, uid) {
4646
var proto = Heatmap.prototype;
4747

4848
proto.handlePick = function(pickResult) {
49-
var index = pickResult.pointId,
50-
shape = this.options.shape;
49+
var shape = this.options.shape,
50+
index = pickResult.pointId,
51+
xIndex = index % shape[0],
52+
yIndex = Math.floor(index / shape[0]),
53+
zIndex = index;
5154

5255
return {
5356
trace: this,
5457
dataCoord: pickResult.dataCoord,
5558
traceCoord: [
56-
this.options.x[index % shape[0]],
57-
this.options.y[Math.floor(index / shape[0])],
58-
this.options.z[index]
59+
this.options.x[xIndex],
60+
this.options.y[yIndex],
61+
this.options.z[zIndex]
5962
],
6063
textLabel: this.textLabels[index],
6164
name: this.name,
65+
pointIndex: [xIndex, yIndex, zIndex],
6266
hoverinfo: this.hoverinfo
6367
};
6468
};

src/traces/pointcloud/convert.js

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ proto.handlePick = function(pickResult) {
6363
this.textLabels,
6464
color: this.color,
6565
name: this.name,
66+
pointIndex: index,
6667
hoverinfo: this.hoverinfo
6768
};
6869
};

0 commit comments

Comments
 (0)