some fixes

This commit is contained in:
grey-cat-1908 2024-03-24 15:18:46 +03:00
parent c6cf8a2df5
commit 4b1c653235
3 changed files with 19 additions and 6 deletions

View file

@ -39,6 +39,8 @@ onMounted(() => {
{'name': 'Конец', 'up': true, 'connectedStations': [], 'step': store.width - 400}
]
window.onbeforeunload = () => false
map = new Map(branch, settings);
build();
@ -117,7 +119,7 @@ function build () {
connectedStations.push(extraStation);
}
let modelStation = new Station(station['name'], station['up'], connectedStations, station['step'])
let modelStation = new Station(station['name'], station['up'], connectedStations, Number(station['step']))
stations.push(modelStation);
}
@ -130,6 +132,10 @@ function build () {
map.build()
}
store.$subscribe((mutation, state) => {
build();
})
</script>
<template>
@ -154,10 +160,9 @@ function build () {
<h2>Управление</h2>
<br>
<div class="">
<v-btn size="x-large" variant="flat" block color="blue" @click="importFile">Импорт</v-btn>
<v-btn size="x-large" variant="flat" block color="orange" @click="exportFile">Экспорт</v-btn>
<v-btn size="x-large" variant="flat" block color="green" @click="save">Сохранить</v-btn>
<v-btn size="x-large" variant="flat" block color="red" @click="build">Предпросмотр</v-btn>
<v-btn size="x-large" variant="flat" block color="orange" @click="exportFile">Экспорт (svg)</v-btn>
<v-btn size="x-large" variant="flat" block color="green" @click="save">Сохранить (json)</v-btn>
<v-btn size="x-large" variant="flat" block color="blue" @click="importFile">Импорт (json)</v-btn>
<input type="file" id="fileInput" style="display: none" @change="setFile" accept=".json" />
<hr>

View file

@ -52,7 +52,13 @@ export class Map implements MetroMap {
this.draw.circle(40).fill(stations[i].branch.color).cx(cx).cy(cy)
let text = this.draw.text(stations[i].branch.number.toString()).fill('white').font({ size: 28}).cx(cx).cy(cy);
let fontSize;
if (stations[i].branch.number.toString().length > 1) {
fontSize = 22;
} else {
fontSize = 28;
}
let text = this.draw.text(stations[i].branch.number.toString()).fill('white').font({ size: fontSize}).cx(cx).cy(cy);
text.font({
family: 'Roboto Mono',
weight: '750',

View file

@ -11,4 +11,6 @@ export const useStore = defineStore('branch', {
height: window.innerHeight / 2
}
},
})