diff options
author | Scott Bell <scott@traclabs.com> | 2022-11-09 03:11:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 03:11:46 +0300 |
commit | fabfecdb3ebb790cb606a15636fad63840a7c645 (patch) | |
tree | d70e508b82b72f286290141bdf324899b9927ae4 | |
parent | a2d8b1320471173d8ea480dba627aa01f9f4bf4f (diff) |
Check for null plot wrapper on plot resize (#5960)
* check for null plot wrapper first
* make code clearer with short circuit up front
-rw-r--r-- | src/plugins/plot/MctPlot.vue | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/plot/MctPlot.vue b/src/plugins/plot/MctPlot.vue index 125ab557e..96a9f2592 100644 --- a/src/plugins/plot/MctPlot.vue +++ b/src/plugins/plot/MctPlot.vue @@ -1192,11 +1192,15 @@ export default { this.$emit('statusUpdated', status); }, handleWindowResize() { - const newOffsetWidth = this.$parent.$refs.plotWrapper.offsetWidth; + const { plotWrapper } = this.$parent.$refs; + if (!plotWrapper) { + return; + } + + const newOffsetWidth = plotWrapper.offsetWidth; //we ignore when width gets smaller const offsetChange = newOffsetWidth - this.offsetWidth; - if (this.$parent.$refs.plotWrapper - && offsetChange > OFFSET_THRESHOLD) { + if (offsetChange > OFFSET_THRESHOLD) { this.offsetWidth = newOffsetWidth; this.config.series.models.forEach(this.loadSeriesData, this); } |