Skip to content

Commit 3eb91c0

Browse files
committed
no need to re-calc 'regl' traces in-and-out of arrayOk values
1 parent f415e96 commit 3eb91c0

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/plot_api/plot_api.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,8 +1572,10 @@ function _restyle(gd, aobj, traces) {
15721572
else {
15731573
if(valObject) {
15741574
// must redo calcdata when restyling array values of arrayOk attributes
1575-
if(valObject.arrayOk && (
1576-
Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))
1575+
// ... but no need to this for regl-based traces
1576+
if(valObject.arrayOk &&
1577+
!Registry.traceIs(contFull, 'regl') &&
1578+
(Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))
15771579
) {
15781580
flags.calc = true;
15791581
}

test/jasmine/tests/splom_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,27 @@ describe('Test splom update switchboard:', function() {
901901

902902
return Plotly.restyle(gd, 'marker.color', [['red', 'green', 'blue']]);
903903
})
904+
.then(function() {
905+
var msg = 'after arrayOk marker.color restyle';
906+
907+
assertSpies(msg, [
908+
['supplyDefaults', 1],
909+
['doCalcdata', 0],
910+
['doTicks', 0],
911+
['clear', 1],
912+
['update', 1],
913+
['draw', 1]
914+
]);
915+
916+
expect(toPlainArray(scene.matrixOptions.colors[0]))
917+
.toBeCloseToArray([1, 0, 0, 1], 1, msg + '- 0');
918+
expect(toPlainArray(scene.matrixOptions.colors[1]))
919+
.toBeCloseToArray([0, 0.501, 0, 1], 1, msg + '- 1');
920+
expect(toPlainArray(scene.matrixOptions.colors[2]))
921+
.toBeCloseToArray([0, 0, 1, 1], 1, msg + '- 2');
922+
923+
return Plotly.restyle(gd, 'marker.size', 20);
924+
})
904925
.catch(failTest)
905926
.then(done);
906927
});

0 commit comments

Comments
 (0)