Only listen on overlay plots

Only listen for mutations on overlay plots, as other mutations
should be ignored by plot configuration.

Fixes https://github.com/nasa/openmct/issues/1945
This commit is contained in:
Pete Richards 2018-04-13 16:52:27 -07:00
parent a958055f50
commit 7d8dc00996

View File

@ -75,11 +75,14 @@ define([
openmct: options.openmct openmct: options.openmct
}); });
this.removeMutationListener = this.openmct.objects.observe( if (this.get('domainObject').type === 'telemetry.plot.overlay') {
this.get('domainObject'), this.removeMutationListener = this.openmct.objects.observe(
'*', this.get('domainObject'),
this.updateDomainObject.bind(this) '*',
); this.updateDomainObject.bind(this)
);
}
this.yAxis.listenToSeriesCollection(this.series); this.yAxis.listenToSeriesCollection(this.series);
this.legend.listenToSeriesCollection(this.series); this.legend.listenToSeriesCollection(this.series);
@ -112,7 +115,9 @@ define([
this.yAxis.destroy(); this.yAxis.destroy();
this.series.destroy(); this.series.destroy();
this.legend.destroy(); this.legend.destroy();
this.removeMutationListener(); if (this.removeMutationListener) {
this.removeMutationListener();
}
}, },
/** /**
* Return defaults, which are extracted from the passed in domain * Return defaults, which are extracted from the passed in domain