Skip to content

Commit

Permalink
PR feedback - cover the other gl2d plot types
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera committed Oct 4, 2016
1 parent 9f77c11 commit 2e54a99
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
16 changes: 10 additions & 6 deletions src/traces/contourgl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,24 @@ function Contour(scene, uid) {
var proto = Contour.prototype;

proto.handlePick = function(pickResult) {
var index = pickResult.pointId,
options = this.heatmapOptions,
shape = options.shape;
var options = this.heatmapOptions,
shape = 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]
options.x[xIndex],
options.y[yIndex],
options.z[zIndex]
],
textLabel: this.textLabels[index],
name: this.name,
pointIndex: [xIndex, yIndex, zIndex],
hoverinfo: this.hoverinfo
};
};
Expand Down
15 changes: 10 additions & 5 deletions src/traces/heatmapgl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,24 @@ function Heatmap(scene, uid) {
var proto = Heatmap.prototype;

proto.handlePick = function(pickResult) {
var index = pickResult.pointId,
shape = this.options.shape;
var options = this.options,
shape = 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]
options.x[xIndex],
options.y[yIndex],
options.z[zIndex]
],
textLabel: this.textLabels[index],
name: this.name,
pointIndex: [xIndex, yIndex, zIndex],
hoverinfo: this.hoverinfo
};
};
Expand Down
1 change: 1 addition & 0 deletions src/traces/pointcloud/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ proto.handlePick = function(pickResult) {
this.textLabels,
color: this.color,
name: this.name,
pointIndex: index,
hoverinfo: this.hoverinfo
};
};
Expand Down

0 comments on commit 2e54a99

Please sign in to comment.