Skip to content

Commit 2e54a99

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

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

src/traces/contourgl/convert.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,24 @@ 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 options = this.heatmapOptions,
64+
shape = options.shape,
65+
index = pickResult.pointId,
66+
xIndex = index % shape[0],
67+
yIndex = Math.floor(index / shape[0]),
68+
zIndex = index;
6669

6770
return {
6871
trace: this,
6972
dataCoord: pickResult.dataCoord,
7073
traceCoord: [
71-
options.x[index % shape[0]],
72-
options.y[Math.floor(index / shape[0])],
73-
options.z[index]
74+
options.x[xIndex],
75+
options.y[yIndex],
76+
options.z[zIndex]
7477
],
7578
textLabel: this.textLabels[index],
7679
name: this.name,
80+
pointIndex: [xIndex, yIndex, zIndex],
7781
hoverinfo: this.hoverinfo
7882
};
7983
};

src/traces/heatmapgl/convert.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,24 @@ 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 options = this.options,
50+
shape = options.shape,
51+
index = pickResult.pointId,
52+
xIndex = index % shape[0],
53+
yIndex = Math.floor(index / shape[0]),
54+
zIndex = index;
5155

5256
return {
5357
trace: this,
5458
dataCoord: pickResult.dataCoord,
5559
traceCoord: [
56-
this.options.x[index % shape[0]],
57-
this.options.y[Math.floor(index / shape[0])],
58-
this.options.z[index]
60+
options.x[xIndex],
61+
options.y[yIndex],
62+
options.z[zIndex]
5963
],
6064
textLabel: this.textLabels[index],
6165
name: this.name,
66+
pointIndex: [xIndex, yIndex, zIndex],
6267
hoverinfo: this.hoverinfo
6368
};
6469
};

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)