mirror of
https://github.com/Spythere/pragotron-td2.git
synced 2026-05-03 13:38:14 +00:00
pragotron: responsywne aspect ratio
This commit is contained in:
@@ -52,6 +52,7 @@ export default defineComponent({
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="pragotron">
|
<div class="pragotron" ref="pragotron">
|
||||||
<div class="pragotron_content">
|
<div class="pragotron_content">
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<div>
|
<div>
|
||||||
@@ -170,6 +170,16 @@ export default defineComponent({
|
|||||||
async created() {
|
async created() {
|
||||||
await this.fetchSceneryInfo();
|
await this.fetchSceneryInfo();
|
||||||
this.selectDefaultCheckpoint();
|
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() {
|
activated() {
|
||||||
@@ -420,6 +430,10 @@ export default defineComponent({
|
|||||||
|
|
||||||
/* ************** */
|
/* ************** */
|
||||||
|
|
||||||
|
.pragotron {
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.filters {
|
.filters {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
Reference in New Issue
Block a user