Skip to content

Commit 143a61e

Browse files
committed
fixup selected textfont.color logic + add a few more tests
1 parent 52614d1 commit 143a61e

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

src/traces/scattergl/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -930,9 +930,10 @@ function styleTextSelection(cd) {
930930
var hasArrayBase = Array.isArray(base);
931931
opts.color = new Array(stash.count);
932932

933+
933934
for(i = 0; i < els.length; i++) {
934935
j = els[i];
935-
opts.color[j] = stc || hasArrayBase ? base[j] : base;
936+
opts.color[j] = stc || (hasArrayBase ? base[j] : base);
936937
}
937938
for(i = 0; i < unels.length; i++) {
938939
j = unels[i];

test/jasmine/tests/gl2d_click_test.js

+47
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,32 @@ describe('@noCI @gl Test gl2d lasso/select:', function() {
792792
]
793793
});
794794
})
795+
.then(function() {
796+
return Plotly.restyle(gd, 'selected.textfont.color', 'red');
797+
})
798+
.then(function() { return select([[100, 100], [250, 250]]); })
799+
.then(function() {
800+
_assertGlTextOpts('after selection - with set selected.textfont.color', {
801+
rgba: [
802+
[
803+
68, 68, 68, 255,
804+
68, 68, 68, 255,
805+
68, 68, 68, 255,
806+
],
807+
[
808+
68, 68, 68, 255,
809+
// this is the selected pt!
810+
255, 0, 0, 255,
811+
68, 68, 68, 255
812+
],
813+
[
814+
68, 68, 68, 255,
815+
68, 68, 68, 255,
816+
68, 68, 68, 255
817+
]
818+
]
819+
});
820+
})
795821
.catch(failTest)
796822
.then(done);
797823
});
@@ -851,6 +877,27 @@ describe('@noCI @gl Test gl2d lasso/select:', function() {
851877
]
852878
});
853879
})
880+
.then(function() {
881+
return Plotly.restyle(gd, 'selected.textfont.color', 'red');
882+
})
883+
.then(function() { return select([[100, 10], [250, 100]]); })
884+
.then(function() {
885+
_assertGlTextOpts('after selection - with set selected.textfont.color', {
886+
rgba: [
887+
[
888+
255, 0, 0, 255,
889+
0, 0, 255, 255,
890+
0, 128, 0, 255
891+
],
892+
[
893+
0, 0, 0, 255,
894+
// this is the selected pt!
895+
255, 0, 0, 255,
896+
237, 97, 0, 255
897+
]
898+
]
899+
});
900+
})
854901
.catch(failTest)
855902
.then(done);
856903
});

0 commit comments

Comments
 (0)