Skip to content

Commit 8619ce1

Browse files
committed
use gl-cone3d picking instead of gl-scatter3d overlay
1 parent 8690ee7 commit 8619ce1

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/traces/cone/convert.js

+1-19
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
'use strict';
1010

11-
var createScatterPlot = require('gl-scatter3d');
1211
var conePlot = require('gl-cone3d');
1312
var createConeMesh = require('gl-cone3d').createConeMesh;
1413

@@ -19,14 +18,13 @@ function Cone(scene, uid) {
1918
this.scene = scene;
2019
this.uid = uid;
2120
this.mesh = null;
22-
this.pts = null;
2321
this.data = null;
2422
}
2523

2624
var proto = Cone.prototype;
2725

2826
proto.handlePick = function(selection) {
29-
if(selection.object === this.pts) {
27+
if(selection.object === this.mesh) {
3028
var selectIndex = selection.index = selection.data.index;
3129
var xx = this.data.x[selectIndex];
3230
var yy = this.data.y[selectIndex];
@@ -96,8 +94,6 @@ function convert(scene, trace) {
9694

9795
var meshData = conePlot(coneOpts);
9896

99-
// stash positions for gl-scatter3d 'hover' trace
100-
meshData._pts = coneOpts.positions;
10197

10298
// pass gl-mesh3d lighting attributes
10399
meshData.lightPosition = [trace.lightposition.x, trace.lightposition.y, trace.lightposition.z];
@@ -119,14 +115,10 @@ proto.update = function(data) {
119115
this.data = data;
120116

121117
var meshData = convert(this.scene, data);
122-
123118
this.mesh.update(meshData);
124-
this.pts.update({position: meshData._pts});
125119
};
126120

127121
proto.dispose = function() {
128-
this.scene.glplot.remove(this.pts);
129-
this.pts.dispose();
130122
this.scene.glplot.remove(this.mesh);
131123
this.mesh.dispose();
132124
};
@@ -137,21 +129,11 @@ function createConeTrace(scene, data) {
137129
var meshData = convert(scene, data);
138130
var mesh = createConeMesh(gl, meshData);
139131

140-
var pts = createScatterPlot({
141-
gl: gl,
142-
position: meshData._pts,
143-
project: false,
144-
opacity: 0
145-
});
146-
147132
var cone = new Cone(scene, data.uid);
148133
cone.mesh = mesh;
149-
cone.pts = pts;
150134
cone.data = data;
151135
mesh._trace = cone;
152-
pts._trace = cone;
153136

154-
scene.glplot.add(pts);
155137
scene.glplot.add(mesh);
156138

157139
return cone;

test/jasmine/tests/cone_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ describe('@gl Test cone interactions', function() {
209209
var scene = gd._fullLayout.scene._scene;
210210
var objs = scene.glplot.objects;
211211

212-
expect(objs.length).toBe(4);
212+
expect(objs.length).toBe(2);
213213

214214
return Plotly.deleteTraces(gd, [0]);
215215
})
216216
.then(function() {
217217
var scene = gd._fullLayout.scene._scene;
218218
var objs = scene.glplot.objects;
219219

220-
expect(objs.length).toBe(2);
220+
expect(objs.length).toBe(1);
221221

222222
return Plotly.deleteTraces(gd, [0]);
223223
})

0 commit comments

Comments
 (0)