mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 08:13:01 +00:00
parent_aspect_ratio suspicious value handling
This commit is contained in:
parent
ef5281e57b
commit
1ab02e6905
1 changed files with 12 additions and 1 deletions
|
@ -33,7 +33,18 @@ export default class extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
const parent = this.$el.parentElement;
|
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() {
|
public mounted() {
|
||||||
|
|
Loading…
Reference in a new issue