This commit is contained in:
grey-cat-1908 2024-03-22 19:21:45 +03:00
parent 4006dafd15
commit 477d650acb

View file

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
// @ts-nocheck
import {Map} from "./models/map.ts"; import {Map} from "./models/map.ts";
import {Branch} from "./models/map/branch.ts"; import {Branch} from "./models/map/branch.ts";
import {onMounted, ref} from 'vue' import {onMounted, ref} from 'vue'
@ -6,7 +8,6 @@ import {Station} from "./models/map/station.ts";
import {ConnectedStation} from "./models/map/connectedStation.ts"; import {ConnectedStation} from "./models/map/connectedStation.ts";
import {ExtraBranch} from "./models/map/extraBranch.ts"; import {ExtraBranch} from "./models/map/extraBranch.ts";
// @ts-ignore
import {set, useEventListener} from '@vueuse/core' import {set, useEventListener} from '@vueuse/core'
import {Settings} from "./models/settings.ts"; import {Settings} from "./models/settings.ts";
import {defineStore} from "pinia"; import {defineStore} from "pinia";
@ -19,7 +20,6 @@ const ycord = ref(0);
const mapWidth = ref(window.innerWidth); const mapWidth = ref(window.innerWidth);
const mapHeight = ref(window.innerHeight / 2); const mapHeight = ref(window.innerHeight / 2);
// @ts-ignore
useEventListener(element, 'click', (evt) => { useEventListener(element, 'click', (evt) => {
xcord.value = evt.offsetX; xcord.value = evt.offsetX;
ycord.value = evt.offsetY; ycord.value = evt.offsetY;
@ -32,12 +32,12 @@ let settings: Settings = new Settings(mapWidth.value, mapHeight.value);
let map: Map; let map: Map;
const useStore = defineStore('branch', { const useStore = defineStore('branch', {
// arrow function recommended for full type inference
state: () => { state: () => {
return { return {
name: 'Тест', name: 'Тест',
number: 1, number: 1,
color: '#0078BE' color: '#0078BE',
stations: []
} }
}, },
}) })
@ -52,19 +52,24 @@ onMounted(() => {
}) })
function build () { function build () {
let extraBranch1: ExtraBranch = new ExtraBranch( "#EF161E", 1) let stations = [];
let extraStation1: ConnectedStation = new ConnectedStation("Библиотека\nимени Ленина", extraBranch1)
let extraBranch4: ExtraBranch = new ExtraBranch( "#00BFFF", 4) for (let station of store.stations) {
let extraStation4: ConnectedStation = new ConnectedStation("Александровский\nсад", extraBranch4) let connectedStations = [];
let extraBranch9: ExtraBranch = new ExtraBranch( "#999999", 9) for (let connected in station['connectedStations']) {
let extraStation9: ConnectedStation = new ConnectedStation("Боровицкая", extraBranch9) let extraBranch: ExtraBranch = new ExtraBranch(connected['branch']['color'], connected['branch']['number']);
let extraStation: ConnectedStation = new ConnectedStation(connected['name'], extraBranch);
let station1: Station = new Station("Смоленская", false, [], 0) connectedStations.push(extraStation);
let station2: Station = new Station("Арбатская", true, [extraStation1, extraStation9, extraStation4], 200) }
let branch: Branch = new Branch(store.name,store.color, store.number, [station1, station2]) let modelStation = new Station(station['name'], station['up'], connectedStations, station['step'])
stations.push(modelStation);
}
let branch: Branch = new Branch(store.name,store.color, store.number, stations)
let settings: Settings = new Settings(mapWidth.value, mapHeight.value); let settings: Settings = new Settings(mapWidth.value, mapHeight.value);
map.setSettings(settings) map.setSettings(settings)