pragotron: responsywne aspect ratio

This commit is contained in:
2023-02-26 15:52:52 +01:00
parent 7f2056547f
commit c679a8a0df
2 changed files with 16 additions and 1 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
<template>
<div class="pragotron">
<div class="pragotron" ref="pragotron">
<div class="pragotron_content">
<div class="filters">
<div>
@@ -170,6 +170,16 @@ export default defineComponent({
async created() {
await this.fetchSceneryInfo();
this.selectDefaultCheckpoint();
window.addEventListener('resize', (e) => {
const elRef = this.$refs['pragotron'] as HTMLElement;
if (!elRef) return;
const scale = Math.min(window.innerWidth / elRef.clientWidth, window.innerHeight / elRef.clientHeight);
if (scale > 1) return;
elRef.style.transform = `scale(${scale})`;
});
},
activated() {
@@ -420,6 +430,10 @@ export default defineComponent({
/* ************** */
.pragotron {
padding: 1em;
}
.filters {
display: flex;
justify-content: space-between;