mirror of
https://github.com/grey-cat-1908/metro.git
synced 2024-11-11 19:07:28 +03:00
some fixes
This commit is contained in:
parent
c6cf8a2df5
commit
4b1c653235
3 changed files with 19 additions and 6 deletions
15
src/App.vue
15
src/App.vue
|
@ -39,6 +39,8 @@ onMounted(() => {
|
||||||
{'name': 'Конец', 'up': true, 'connectedStations': [], 'step': store.width - 400}
|
{'name': 'Конец', 'up': true, 'connectedStations': [], 'step': store.width - 400}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
window.onbeforeunload = () => false
|
||||||
|
|
||||||
map = new Map(branch, settings);
|
map = new Map(branch, settings);
|
||||||
|
|
||||||
build();
|
build();
|
||||||
|
@ -117,7 +119,7 @@ function build () {
|
||||||
connectedStations.push(extraStation);
|
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);
|
stations.push(modelStation);
|
||||||
}
|
}
|
||||||
|
@ -130,6 +132,10 @@ function build () {
|
||||||
|
|
||||||
map.build()
|
map.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store.$subscribe((mutation, state) => {
|
||||||
|
build();
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -154,10 +160,9 @@ function build () {
|
||||||
<h2>Управление</h2>
|
<h2>Управление</h2>
|
||||||
<br>
|
<br>
|
||||||
<div class="">
|
<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">Экспорт (svg)</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">Сохранить (json)</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="blue" @click="importFile">Импорт (json)</v-btn>
|
||||||
<v-btn size="x-large" variant="flat" block color="red" @click="build">Предпросмотр</v-btn>
|
|
||||||
|
|
||||||
<input type="file" id="fileInput" style="display: none" @change="setFile" accept=".json" />
|
<input type="file" id="fileInput" style="display: none" @change="setFile" accept=".json" />
|
||||||
<hr>
|
<hr>
|
||||||
|
|
|
@ -52,7 +52,13 @@ export class Map implements MetroMap {
|
||||||
|
|
||||||
this.draw.circle(40).fill(stations[i].branch.color).cx(cx).cy(cy)
|
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({
|
text.font({
|
||||||
family: 'Roboto Mono',
|
family: 'Roboto Mono',
|
||||||
weight: '750',
|
weight: '750',
|
||||||
|
|
|
@ -11,4 +11,6 @@ export const useStore = defineStore('branch', {
|
||||||
height: window.innerHeight / 2
|
height: window.innerHeight / 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
Loading…
Reference in a new issue