Skip to content

Commit 6def5e4

Browse files
committed
Fix text tests
1 parent 90479a7 commit 6def5e4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/traces/scattergl/index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var createLine = require('regl-line2d');
1313
var createError = require('regl-error2d');
1414
var cluster = require('point-cluster');
1515
var arrayRange = require('array-range');
16-
var Text = require('gl-text');
16+
var Text = require('../../../../gl-text/index');
1717

1818
var Registry = require('../../registry');
1919
var Lib = require('../../lib');
@@ -215,7 +215,6 @@ function sceneUpdate(gd, subplot) {
215215
for(i = 0; i < scene.count; i++) {
216216
opts[i] = opt;
217217
}
218-
219218
if(scene.fill2d) scene.fill2d.update(opts);
220219
if(scene.scatter2d) scene.scatter2d.update(opts);
221220
if(scene.line2d) scene.line2d.update(opts);
@@ -829,7 +828,8 @@ function selectPoints(searchInfo, polygon) {
829828
if(!scene) return selection;
830829

831830
var hasText = subTypes.hasText(trace);
832-
var hasOnlyLines = !subTypes.hasMarkers(trace) && !hasText;
831+
var hasMarkers = subTypes.hasMarkers(trace);
832+
var hasOnlyLines = !hasMarkers && !hasText;
833833
if(trace.visible !== true || hasOnlyLines) return selection;
834834

835835
// degenerate polygon does not enable selection
@@ -870,24 +870,30 @@ function selectPoints(searchInfo, polygon) {
870870
scene.unselectBatch[i] = [];
871871
}
872872
// we should turn scatter2d into unselected once we have any points selected
873-
scene.scatter2d.update(scene.unselectedOptions);
873+
if(hasMarkers) {
874+
scene.scatter2d.update(scene.unselectedOptions);
875+
}
874876
}
875877

876878
// update texts selection
877879
if(hasText) {
878-
var el, textOptions;
880+
var el, textOptions, selOptions;
879881
if(els) {
880882
for(i = 0; i < els.length; i++) {
881883
el = els[i];
882-
textOptions = scene.selectedOptions[stash.index].textfont;
884+
selOptions = scene.selectedOptions[stash.index];
885+
if(!selOptions) continue;
886+
textOptions = selOptions.textfont;
883887
if(!textOptions) continue;
884888
scene.glText[stash.index][el].update(textOptions[el]);
885889
}
886890
}
887891
if(unels) {
888892
for(i = 0; i < unels.length; i++) {
889893
el = unels[i];
890-
textOptions = scene.unselectedOptions[stash.index].textfont || scene.textOptions[stash.index][el];
894+
selOptions = scene.unselectedOptions[stash.index];
895+
if(!selOptions) continue;
896+
textOptions = selOptions.textfont || scene.textOptions[stash.index][el];
891897
scene.glText[stash.index][el].update(textOptions);
892898
}
893899
}

0 commit comments

Comments
 (0)