Skip to content

Commit 8e512c9

Browse files
committed
drop anim:true in valObject of non-animatable modules
1 parent fc81b9e commit 8e512c9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/plot_api/plot_schema.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var Registry = require('../registry');
@@ -517,6 +516,15 @@ function getTraceAttributes(type) {
517516
out.layoutAttributes = formatAttributes(layoutAttributes);
518517
}
519518

519+
// drop anim:true in non-animatable modules
520+
if(!_module.animatable) {
521+
exports.crawl(out, function(attr) {
522+
if(exports.isValObject(attr) && 'anim' in attr) {
523+
delete attr.anim;
524+
}
525+
});
526+
}
527+
520528
return out;
521529
}
522530

test/jasmine/bundle_tests/plotschema_test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,22 @@ describe('plot schema', function() {
377377
expect(traces.parcoords.attributes.hoverinfo).toBe(undefined, 'no hover attrs for parcoords');
378378
expect(traces.scatter3d.attributes.selectedpoints).toBe(undefined, 'no selectedpoints for gl3d traces');
379379
});
380+
381+
it('traces that are not animatable should not list `anim:true` attributes', function() {
382+
var notAnimatable = Object.keys(plotSchema.traces).filter(function(traceType) {
383+
return !plotSchema.traces[traceType].animatable;
384+
});
385+
386+
notAnimatable.forEach(function(traceType) {
387+
Plotly.PlotSchema.crawl(plotSchema.traces[traceType].attributes, function() {
388+
var attr = arguments[0];
389+
var astr = arguments[4];
390+
if(Plotly.PlotSchema.isValObject(attr) && 'anim' in attr) {
391+
fail('Trace module ' + traceType + ' sets *' + astr + '* with anim:true');
392+
}
393+
});
394+
});
395+
});
380396
});
381397

382398
describe('getTraceValObject', function() {

0 commit comments

Comments
 (0)