Skip to content

Commit 28b9921

Browse files
committed
use fullData item _index field for curveNumber gl2d event data
1 parent a9e1dd6 commit 28b9921

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/plots/gl2d/scene2d.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function Scene2D(options, fullLayout) {
5151

5252
// trace set
5353
this.traces = {};
54-
this._inputs = {};
5554

5655
// create axes spikes
5756
this.spikes = createSpikes(this.glplot);
@@ -362,7 +361,6 @@ proto.destroy = function() {
362361
this.container.removeChild(this.mouseContainer);
363362

364363
this.fullData = null;
365-
this._inputs = null;
366364
this.glplot = null;
367365
this.stopped = true;
368366
};
@@ -487,7 +485,6 @@ proto.updateTraces = function(fullData, calcData) {
487485
// update / create trace objects
488486
for(i = 0; i < fullData.length; i++) {
489487
fullTrace = fullData[i];
490-
this._inputs[fullTrace.uid] = i;
491488
var calcTrace = calcData[i],
492489
traceObj = this.traces[fullTrace.uid];
493490

@@ -500,16 +497,22 @@ proto.updateTraces = function(fullData, calcData) {
500497
};
501498

502499
proto.emitPointAction = function(nextSelection, eventType) {
500+
var uid = nextSelection.trace.uid;
501+
var trace;
503502

504-
var curveIndex = this._inputs[nextSelection.trace.uid];
503+
for(var i = 0; i < this.fullData.length; i++) {
504+
if(this.fullData[i].uid === uid) {
505+
trace = this.fullData[i];
506+
}
507+
}
505508

506509
this.graphDiv.emit(eventType, {
507510
points: [{
508511
x: nextSelection.traceCoord[0],
509512
y: nextSelection.traceCoord[1],
510-
curveNumber: curveIndex,
513+
curveNumber: trace.index,
511514
pointNumber: nextSelection.pointIndex,
512-
data: this.fullData[curveIndex]._input,
515+
data: trace._input,
513516
fullData: this.fullData,
514517
xaxis: this.xaxis,
515518
yaxis: this.yaxis

0 commit comments

Comments
 (0)