parent_aspect_ratio suspicious value handling

This commit is contained in:
Jörn-Michael Miehe 2023-02-02 22:55:30 +00:00
parent ef5281e57b
commit 1ab02e6905

View file

@ -33,7 +33,18 @@ export default class extends Vue {
}
const parent = this.$el.parentElement;
return parent.clientWidth / parent.clientHeight;
const result = parent.clientWidth / parent.clientHeight;
// force recompute for suspicious results
if (result === 0 || result === Infinity) {
// don't loop endlessly
if (this.refreshKey < 10000) {
this.refreshKey++;
}
return 1;
}
return result;
}
public mounted() {