Rename some types
This commit is contained in:
parent
e92ad7294e
commit
9bea4519c6
10
src/api.ts
10
src/api.ts
@ -29,13 +29,11 @@ import {
|
|||||||
DynmapTileUpdate,
|
DynmapTileUpdate,
|
||||||
DynmapUpdate,
|
DynmapUpdate,
|
||||||
DynmapUpdateResponse,
|
DynmapUpdateResponse,
|
||||||
DynmapUpdates,
|
DynmapUpdates
|
||||||
DynmapWorld,
|
|
||||||
DynmapWorldMap
|
|
||||||
} from "@/dynmap";
|
} from "@/dynmap";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import ChatError from "@/errors/ChatError";
|
import ChatError from "@/errors/ChatError";
|
||||||
import {LiveAtlasMessageConfig} from "@/index";
|
import {LiveAtlasMessageConfig, LiveAtlasWorld} from "@/index";
|
||||||
|
|
||||||
const titleColours = /§[0-9a-f]/ig;
|
const titleColours = /§[0-9a-f]/ig;
|
||||||
|
|
||||||
@ -103,8 +101,8 @@ function buildMessagesConfig(response: any): LiveAtlasMessageConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildWorlds(response: any): Array<DynmapWorld> {
|
function buildWorlds(response: any): Array<LiveAtlasWorld> {
|
||||||
const worlds: Map<string, DynmapWorld> = new Map<string, DynmapWorld>();
|
const worlds: Map<string, LiveAtlasWorld> = new Map<string, LiveAtlasWorld>();
|
||||||
|
|
||||||
//Get all the worlds first so we can handle append_to_world properly
|
//Get all the worlds first so we can handle append_to_world properly
|
||||||
(response.worlds || []).forEach((world: any) => {
|
(response.worlds || []).forEach((world: any) => {
|
||||||
|
@ -44,11 +44,12 @@ import LinkControl from "@/components/map/control/LinkControl.vue";
|
|||||||
import ChatControl from "@/components/map/control/ChatControl.vue";
|
import ChatControl from "@/components/map/control/ChatControl.vue";
|
||||||
import LogoControl from "@/components/map/control/LogoControl.vue";
|
import LogoControl from "@/components/map/control/LogoControl.vue";
|
||||||
import {MutationTypes} from "@/store/mutation-types";
|
import {MutationTypes} from "@/store/mutation-types";
|
||||||
import {Coordinate, DynmapPlayer} from "@/dynmap";
|
import {DynmapPlayer} from "@/dynmap";
|
||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import DynmapMap from "@/leaflet/DynmapMap";
|
||||||
import {LoadingControl} from "@/leaflet/control/LoadingControl";
|
import {LoadingControl} from "@/leaflet/control/LoadingControl";
|
||||||
import MapContextMenu from "@/components/map/MapContextMenu.vue";
|
import MapContextMenu from "@/components/map/MapContextMenu.vue";
|
||||||
|
import {Coordinate} from "@/index";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@ -324,4 +325,4 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent, onUnmounted, computed, watch} from "@vue/runtime-core";
|
import {defineComponent, onUnmounted, computed, watch} from "@vue/runtime-core";
|
||||||
import {DynmapWorldMap} from "@/dynmap";
|
|
||||||
import {Map} from 'leaflet';
|
import {Map} from 'leaflet';
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {MutationTypes} from "@/store/mutation-types";
|
import {MutationTypes} from "@/store/mutation-types";
|
||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import {getMinecraftTime} from "@/util";
|
import {getMinecraftTime} from "@/util";
|
||||||
import {DynmapTileLayer} from "@/leaflet/tileLayer/DynmapTileLayer";
|
import {DynmapTileLayer} from "@/leaflet/tileLayer/DynmapTileLayer";
|
||||||
|
import {LiveAtlasWorldMap} from "@/index";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@ -31,7 +31,7 @@ export default defineComponent({
|
|||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
type: Object as () => DynmapWorldMap,
|
type: Object as () => LiveAtlasWorldMap,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
leaflet: {
|
leaflet: {
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {DynmapWorld, DynmapWorldMap} from "@/dynmap";
|
|
||||||
import {defineComponent} from 'vue';
|
import {defineComponent} from 'vue';
|
||||||
import {MutationTypes} from "@/store/mutation-types";
|
import {MutationTypes} from "@/store/mutation-types";
|
||||||
import SvgIcon from "@/components/SvgIcon.vue";
|
import SvgIcon from "@/components/SvgIcon.vue";
|
||||||
@ -47,13 +46,14 @@ import "@/assets/icons/block_the_end_surface.svg";
|
|||||||
import "@/assets/icons/block_other.svg";
|
import "@/assets/icons/block_other.svg";
|
||||||
import "@/assets/icons/block_other_flat.svg";
|
import "@/assets/icons/block_other_flat.svg";
|
||||||
import "@/assets/icons/block_skylands.svg";
|
import "@/assets/icons/block_skylands.svg";
|
||||||
|
import {LiveAtlasWorld, LiveAtlasWorldMap} from "@/index";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'WorldListItem',
|
name: 'WorldListItem',
|
||||||
components: {SvgIcon},
|
components: {SvgIcon},
|
||||||
props: {
|
props: {
|
||||||
world: {
|
world: {
|
||||||
type: Object as () => DynmapWorld,
|
type: Object as () => LiveAtlasWorld,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
@ -75,7 +75,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getMapIcon(map: DynmapWorldMap): string {
|
getMapIcon(map: LiveAtlasWorldMap): string {
|
||||||
let worldType: string,
|
let worldType: string,
|
||||||
mapType: string;
|
mapType: string;
|
||||||
|
|
||||||
|
63
src/dynmap.d.ts
vendored
63
src/dynmap.d.ts
vendored
@ -18,7 +18,7 @@ import {PathOptions, PointTuple, PolylineOptions} from "leaflet";
|
|||||||
import {CoordinatesControlOptions} from "@/leaflet/control/CoordinatesControl";
|
import {CoordinatesControlOptions} from "@/leaflet/control/CoordinatesControl";
|
||||||
import {LogoControlOptions} from "@/leaflet/control/LogoControl";
|
import {LogoControlOptions} from "@/leaflet/control/LogoControl";
|
||||||
import {ClockControlOptions} from "@/leaflet/control/ClockControl";
|
import {ClockControlOptions} from "@/leaflet/control/ClockControl";
|
||||||
import {LiveAtlasMessageConfig} from "@/index";
|
import {Coordinate, LiveAtlasLocation, LiveAtlasMessageConfig, LiveAtlasWorld, LiveAtlasWorldState} from "@/index";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
@ -94,63 +94,16 @@ interface DynmapChatSendingConfig {
|
|||||||
cooldown: number;
|
cooldown: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DynmapWorld {
|
|
||||||
seaLevel: number;
|
|
||||||
name: string;
|
|
||||||
protected: boolean;
|
|
||||||
title: string;
|
|
||||||
height: number;
|
|
||||||
center: Coordinate;
|
|
||||||
maps: Map<string, DynmapWorldMap>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DynmapWorldMap {
|
|
||||||
world: DynmapWorld;
|
|
||||||
name: string;
|
|
||||||
icon: string;
|
|
||||||
title: string;
|
|
||||||
background: string;
|
|
||||||
nightAndDay: boolean;
|
|
||||||
backgroundDay?: string;
|
|
||||||
backgroundNight?: string;
|
|
||||||
imageFormat: string;
|
|
||||||
prefix: string;
|
|
||||||
protected: boolean;
|
|
||||||
mapToWorld: [number, number, number, number, number, number, number, number, number];
|
|
||||||
worldToMap: [number, number, number, number, number, number, number, number, number];
|
|
||||||
nativeZoomLevels: number;
|
|
||||||
extraZoomLevels: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DynmapWorldState {
|
|
||||||
raining: boolean;
|
|
||||||
thundering: boolean;
|
|
||||||
timeOfDay: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Coordinate {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
z: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DynmapLocation {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
z: number;
|
|
||||||
world?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DynmapConfigurationResponse {
|
interface DynmapConfigurationResponse {
|
||||||
config: DynmapServerConfig,
|
config: DynmapServerConfig,
|
||||||
messages: LiveAtlasMessageConfig,
|
messages: LiveAtlasMessageConfig,
|
||||||
worlds: Array<DynmapWorld>,
|
worlds: Array<LiveAtlasWorld>,
|
||||||
components: DynmapComponentConfig,
|
components: DynmapComponentConfig,
|
||||||
loggedIn: boolean,
|
loggedIn: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DynmapUpdateResponse {
|
interface DynmapUpdateResponse {
|
||||||
worldState: DynmapWorldState;
|
worldState: LiveAtlasWorldState;
|
||||||
configHash: number;
|
configHash: number;
|
||||||
playerCount: number;
|
playerCount: number;
|
||||||
players: Set<DynmapPlayer>;
|
players: Set<DynmapPlayer>;
|
||||||
@ -165,7 +118,7 @@ interface DynmapPlayer {
|
|||||||
name: string;
|
name: string;
|
||||||
sort: number;
|
sort: number;
|
||||||
hidden: boolean;
|
hidden: boolean;
|
||||||
location: DynmapLocation;
|
location: LiveAtlasLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DynmapMarkerSet {
|
interface DynmapMarkerSet {
|
||||||
@ -277,14 +230,6 @@ interface DynmapTileUpdate {
|
|||||||
timestamp: number
|
timestamp: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DynmapParsedUrl {
|
|
||||||
world?: string;
|
|
||||||
map?: string;
|
|
||||||
location?: Coordinate;
|
|
||||||
zoom?: number;
|
|
||||||
legacy: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DynmapChat {
|
interface DynmapChat {
|
||||||
type: 'chat' | 'playerjoin' | 'playerleave';
|
type: 'chat' | 'playerjoin' | 'playerleave';
|
||||||
playerAccount?: string;
|
playerAccount?: string;
|
||||||
|
61
src/index.d.ts
vendored
61
src/index.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import {State} from "@/store";
|
import {State} from "@/store";
|
||||||
import {DynmapPlayer, DynmapUrlConfig} from "@/dynmap";
|
import {DynmapPlayer, DynmapUrlConfig, LiveAtlasWorldMap} from "@/dynmap";
|
||||||
|
|
||||||
declare module "*.png" {
|
declare module "*.png" {
|
||||||
const value: any;
|
const value: any;
|
||||||
@ -7,11 +7,24 @@ declare module "*.png" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import type { DefineComponent } from 'vue'
|
import type {DefineComponent} from 'vue'
|
||||||
const component: DefineComponent<{}, {}, any>
|
const component: DefineComponent<{}, {}, any>
|
||||||
export default component
|
export default component
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Coordinate {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
z: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LiveAtlasLocation {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
z: number;
|
||||||
|
world?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface LiveAtlasServerDefinition {
|
interface LiveAtlasServerDefinition {
|
||||||
id: string
|
id: string
|
||||||
label?: string
|
label?: string
|
||||||
@ -69,3 +82,45 @@ export type LiveAtlasSidebarSection = 'servers' | 'players' | 'maps';
|
|||||||
interface LiveAtlasSortedPlayers extends Array<DynmapPlayer> {
|
interface LiveAtlasSortedPlayers extends Array<DynmapPlayer> {
|
||||||
dirty?: boolean;
|
dirty?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface LiveAtlasWorld {
|
||||||
|
seaLevel: number;
|
||||||
|
name: string;
|
||||||
|
protected: boolean;
|
||||||
|
title: string;
|
||||||
|
height: number;
|
||||||
|
center: Coordinate;
|
||||||
|
maps: Map<string, LiveAtlasWorldMap>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LiveAtlasWorldState {
|
||||||
|
raining: boolean;
|
||||||
|
thundering: boolean;
|
||||||
|
timeOfDay: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LiveAtlasWorldMap {
|
||||||
|
world: LiveAtlasWorld;
|
||||||
|
name: string;
|
||||||
|
icon: string;
|
||||||
|
title: string;
|
||||||
|
background: string;
|
||||||
|
nightAndDay: boolean;
|
||||||
|
backgroundDay?: string;
|
||||||
|
backgroundNight?: string;
|
||||||
|
imageFormat: string;
|
||||||
|
prefix: string;
|
||||||
|
protected: boolean;
|
||||||
|
mapToWorld: [number, number, number, number, number, number, number, number, number];
|
||||||
|
worldToMap: [number, number, number, number, number, number, number, number, number];
|
||||||
|
nativeZoomLevels: number;
|
||||||
|
extraZoomLevels: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LiveAtlasParsedUrl {
|
||||||
|
world?: string;
|
||||||
|
map?: string;
|
||||||
|
location?: Coordinate;
|
||||||
|
zoom?: number;
|
||||||
|
legacy: boolean;
|
||||||
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import {ControlOptions, DomUtil, Util, Control} from 'leaflet';
|
import {ControlOptions, DomUtil, Util, Control} from 'leaflet';
|
||||||
import {getMinecraftTime} from '@/util';
|
import {getMinecraftTime} from '@/util';
|
||||||
import {DynmapWorldState} from "@/dynmap";
|
|
||||||
|
|
||||||
import {watch} from "@vue/runtime-core";
|
import {watch} from "@vue/runtime-core";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
@ -30,6 +29,7 @@ import "@/assets/icons/clock_moon_storm.svg";
|
|||||||
import "@/assets/icons/clock_sun.svg";
|
import "@/assets/icons/clock_sun.svg";
|
||||||
import "@/assets/icons/clock_sun_rain.svg";
|
import "@/assets/icons/clock_sun_rain.svg";
|
||||||
import "@/assets/icons/clock_sun_storm.svg";
|
import "@/assets/icons/clock_sun_storm.svg";
|
||||||
|
import {LiveAtlasWorldState} from "@/index";
|
||||||
|
|
||||||
export interface ClockControlOptions extends ControlOptions {
|
export interface ClockControlOptions extends ControlOptions {
|
||||||
showTimeOfDay: boolean;
|
showTimeOfDay: boolean;
|
||||||
@ -92,7 +92,7 @@ export class ClockControl extends Control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_update(worldState: DynmapWorldState) {
|
_update(worldState: LiveAtlasWorldState) {
|
||||||
const timeOfDay = worldState.timeOfDay;
|
const timeOfDay = worldState.timeOfDay;
|
||||||
let sunAngle;
|
let sunAngle;
|
||||||
|
|
||||||
@ -170,4 +170,4 @@ export class ClockControl extends Control {
|
|||||||
this._currentMoonIcon = icon;
|
this._currentMoonIcon = icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
import {ControlOptions, LeafletMouseEvent, Control, Map, DomUtil, Util} from 'leaflet';
|
import {ControlOptions, LeafletMouseEvent, Control, Map, DomUtil, Util} from 'leaflet';
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {Coordinate} from "@/dynmap";
|
import {Coordinate} from "@/index";
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {Util, LatLng, Class} from 'leaflet';
|
import {Util, LatLng, Class} from 'leaflet';
|
||||||
import {Coordinate} from "@/dynmap";
|
import {Coordinate} from "@/index";
|
||||||
|
|
||||||
export interface DynmapProjectionOptions {
|
export interface DynmapProjectionOptions {
|
||||||
mapToWorld: [number, number, number, number, number, number, number, number, number],
|
mapToWorld: [number, number, number, number, number, number, number, number, number],
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
import {TileLayer, Coords, DoneCallback, TileLayerOptions, DomUtil, Util, LatLng} from 'leaflet';
|
import {TileLayer, Coords, DoneCallback, TileLayerOptions, DomUtil, Util, LatLng} from 'leaflet';
|
||||||
import {DynmapProjection} from "@/leaflet/projection/DynmapProjection";
|
import {DynmapProjection} from "@/leaflet/projection/DynmapProjection";
|
||||||
import {Coordinate, DynmapWorldMap} from "@/dynmap";
|
|
||||||
import {store} from "@/store";
|
import {store} from "@/store";
|
||||||
|
import {Coordinate, LiveAtlasWorldMap} from "@/index";
|
||||||
|
|
||||||
export interface DynmapTileLayerOptions extends TileLayerOptions {
|
export interface DynmapTileLayerOptions extends TileLayerOptions {
|
||||||
mapSettings: DynmapWorldMap;
|
mapSettings: LiveAtlasWorldMap;
|
||||||
errorTileUrl: string;
|
errorTileUrl: string;
|
||||||
night?: boolean;
|
night?: boolean;
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ export interface DynmapTileLayerOptions extends TileLayerOptions {
|
|||||||
export interface DynmapTileLayer extends TileLayer {
|
export interface DynmapTileLayer extends TileLayer {
|
||||||
options: DynmapTileLayerOptions;
|
options: DynmapTileLayerOptions;
|
||||||
_projection: DynmapProjection;
|
_projection: DynmapProjection;
|
||||||
_mapSettings: DynmapWorldMap;
|
_mapSettings: LiveAtlasWorldMap;
|
||||||
_cachedTileUrls: Map<string, string>;
|
_cachedTileUrls: Map<string, string>;
|
||||||
_namedTiles: Map<string, DynmapTileElement>;
|
_namedTiles: Map<string, DynmapTileElement>;
|
||||||
_tileTemplate: DynmapTileElement;
|
_tileTemplate: DynmapTileElement;
|
||||||
|
@ -25,9 +25,10 @@ import {
|
|||||||
DynmapMarkerSet,
|
DynmapMarkerSet,
|
||||||
DynmapMarkerUpdate,
|
DynmapMarkerUpdate,
|
||||||
DynmapPlayer, DynmapTileUpdate,
|
DynmapPlayer, DynmapTileUpdate,
|
||||||
DynmapUpdateResponse, DynmapWorld
|
DynmapUpdateResponse
|
||||||
} from "@/dynmap";
|
} from "@/dynmap";
|
||||||
import {getAPI} from "@/util";
|
import {getAPI} from "@/util";
|
||||||
|
import {LiveAtlasWorld} from "@/index";
|
||||||
|
|
||||||
type AugmentedActionContext = {
|
type AugmentedActionContext = {
|
||||||
commit<K extends keyof Mutations>(
|
commit<K extends keyof Mutations>(
|
||||||
@ -118,7 +119,7 @@ export const actions: ActionTree<State, State> & Actions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(worldName) {
|
if(worldName) {
|
||||||
const world = state.worlds.get(worldName) as DynmapWorld;
|
const world = state.worlds.get(worldName) as LiveAtlasWorld;
|
||||||
|
|
||||||
// Use config default map if it exists
|
// Use config default map if it exists
|
||||||
if(config.config.defaultMap && world.maps.has(config.config.defaultMap)) {
|
if(config.config.defaultMap && world.maps.has(config.config.defaultMap)) {
|
||||||
|
@ -21,22 +21,21 @@ import {
|
|||||||
DynmapArea,
|
DynmapArea,
|
||||||
DynmapCircle,
|
DynmapCircle,
|
||||||
DynmapComponentConfig,
|
DynmapComponentConfig,
|
||||||
DynmapLine, Coordinate,
|
DynmapLine, DynmapMarker,
|
||||||
DynmapMarker,
|
|
||||||
DynmapMarkerSet,
|
DynmapMarkerSet,
|
||||||
DynmapMarkerSetUpdates,
|
DynmapMarkerSetUpdates,
|
||||||
DynmapPlayer,
|
DynmapPlayer,
|
||||||
DynmapServerConfig, DynmapTileUpdate,
|
DynmapServerConfig, DynmapTileUpdate,
|
||||||
DynmapWorld,
|
DynmapChat
|
||||||
DynmapWorldState, DynmapParsedUrl, DynmapChat
|
|
||||||
} from "@/dynmap";
|
} from "@/dynmap";
|
||||||
import {DynmapProjection} from "@/leaflet/projection/DynmapProjection";
|
import {DynmapProjection} from "@/leaflet/projection/DynmapProjection";
|
||||||
import {
|
import {
|
||||||
|
Coordinate, LiveAtlasWorldState,
|
||||||
LiveAtlasMessageConfig,
|
LiveAtlasMessageConfig,
|
||||||
LiveAtlasServerDefinition,
|
LiveAtlasServerDefinition,
|
||||||
LiveAtlasSidebarSection,
|
LiveAtlasSidebarSection,
|
||||||
LiveAtlasSortedPlayers,
|
LiveAtlasSortedPlayers,
|
||||||
LiveAtlasUIElement
|
LiveAtlasUIElement, LiveAtlasWorld, LiveAtlasParsedUrl
|
||||||
} from "@/index";
|
} from "@/index";
|
||||||
|
|
||||||
export type CurrentMapPayload = {
|
export type CurrentMapPayload = {
|
||||||
@ -51,13 +50,13 @@ export type Mutations<S = State> = {
|
|||||||
[MutationTypes.SET_CONFIGURATION_HASH](state: S, hash: number): void
|
[MutationTypes.SET_CONFIGURATION_HASH](state: S, hash: number): void
|
||||||
[MutationTypes.CLEAR_CONFIGURATION_HASH](state: S): void
|
[MutationTypes.CLEAR_CONFIGURATION_HASH](state: S): void
|
||||||
[MutationTypes.SET_MESSAGES](state: S, messages: LiveAtlasMessageConfig): void
|
[MutationTypes.SET_MESSAGES](state: S, messages: LiveAtlasMessageConfig): void
|
||||||
[MutationTypes.SET_WORLDS](state: S, worlds: Array<DynmapWorld>): void
|
[MutationTypes.SET_WORLDS](state: S, worlds: Array<LiveAtlasWorld>): void
|
||||||
[MutationTypes.CLEAR_WORLDS](state: S): void
|
[MutationTypes.CLEAR_WORLDS](state: S): void
|
||||||
[MutationTypes.SET_COMPONENTS](state: S, worlds: DynmapComponentConfig): void
|
[MutationTypes.SET_COMPONENTS](state: S, worlds: DynmapComponentConfig): void
|
||||||
[MutationTypes.SET_MARKER_SETS](state: S, worlds: Map<string, DynmapMarkerSet>): void
|
[MutationTypes.SET_MARKER_SETS](state: S, worlds: Map<string, DynmapMarkerSet>): void
|
||||||
[MutationTypes.CLEAR_MARKER_SETS](state: S): void
|
[MutationTypes.CLEAR_MARKER_SETS](state: S): void
|
||||||
[MutationTypes.ADD_WORLD](state: S, world: DynmapWorld): void
|
[MutationTypes.ADD_WORLD](state: S, world: LiveAtlasWorld): void
|
||||||
[MutationTypes.SET_WORLD_STATE](state: S, worldState: DynmapWorldState): void
|
[MutationTypes.SET_WORLD_STATE](state: S, worldState: LiveAtlasWorldState): void
|
||||||
[MutationTypes.SET_UPDATE_TIMESTAMP](state: S, time: Date): void
|
[MutationTypes.SET_UPDATE_TIMESTAMP](state: S, time: Date): void
|
||||||
[MutationTypes.ADD_MARKER_SET_UPDATES](state: S, updates: Map<string, DynmapMarkerSetUpdates>): void
|
[MutationTypes.ADD_MARKER_SET_UPDATES](state: S, updates: Map<string, DynmapMarkerSetUpdates>): void
|
||||||
[MutationTypes.ADD_TILE_UPDATES](state: S, updates: Array<DynmapTileUpdate>): void
|
[MutationTypes.ADD_TILE_UPDATES](state: S, updates: Array<DynmapTileUpdate>): void
|
||||||
@ -78,7 +77,7 @@ export type Mutations<S = State> = {
|
|||||||
[MutationTypes.SET_CURRENT_PROJECTION](state: S, payload: DynmapProjection): void
|
[MutationTypes.SET_CURRENT_PROJECTION](state: S, payload: DynmapProjection): void
|
||||||
[MutationTypes.SET_CURRENT_LOCATION](state: S, payload: Coordinate): void
|
[MutationTypes.SET_CURRENT_LOCATION](state: S, payload: Coordinate): void
|
||||||
[MutationTypes.SET_CURRENT_ZOOM](state: S, payload: number): void
|
[MutationTypes.SET_CURRENT_ZOOM](state: S, payload: number): void
|
||||||
[MutationTypes.SET_PARSED_URL](state: S, payload: DynmapParsedUrl): void
|
[MutationTypes.SET_PARSED_URL](state: S, payload: LiveAtlasParsedUrl): void
|
||||||
[MutationTypes.CLEAR_PARSED_URL](state: S): void
|
[MutationTypes.CLEAR_PARSED_URL](state: S): void
|
||||||
[MutationTypes.CLEAR_CURRENT_MAP](state: S): void
|
[MutationTypes.CLEAR_CURRENT_MAP](state: S): void
|
||||||
[MutationTypes.SET_FOLLOW_TARGET](state: S, payload: DynmapPlayer): void
|
[MutationTypes.SET_FOLLOW_TARGET](state: S, payload: DynmapPlayer): void
|
||||||
@ -136,7 +135,7 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//Sets the list of worlds, and their settings, from the initial config fetch
|
//Sets the list of worlds, and their settings, from the initial config fetch
|
||||||
[MutationTypes.SET_WORLDS](state: State, worlds: Array<DynmapWorld>) {
|
[MutationTypes.SET_WORLDS](state: State, worlds: Array<LiveAtlasWorld>) {
|
||||||
state.worlds.clear();
|
state.worlds.clear();
|
||||||
state.maps.clear();
|
state.maps.clear();
|
||||||
|
|
||||||
@ -205,12 +204,12 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
state.pendingSetUpdates.clear();
|
state.pendingSetUpdates.clear();
|
||||||
},
|
},
|
||||||
|
|
||||||
[MutationTypes.ADD_WORLD](state: State, world: DynmapWorld) {
|
[MutationTypes.ADD_WORLD](state: State, world: LiveAtlasWorld) {
|
||||||
state.worlds.set(world.name, world);
|
state.worlds.set(world.name, world);
|
||||||
},
|
},
|
||||||
|
|
||||||
//Sets the current world state an update fetch
|
//Sets the current world state an update fetch
|
||||||
[MutationTypes.SET_WORLD_STATE](state: State, worldState: DynmapWorldState) {
|
[MutationTypes.SET_WORLD_STATE](state: State, worldState: LiveAtlasWorldState) {
|
||||||
state.currentWorldState = Object.assign(state.currentWorldState, worldState);
|
state.currentWorldState = Object.assign(state.currentWorldState, worldState);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -492,7 +491,7 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//Sets the result of parsing the current map url, if present and valid
|
//Sets the result of parsing the current map url, if present and valid
|
||||||
[MutationTypes.SET_PARSED_URL](state: State, payload: DynmapParsedUrl) {
|
[MutationTypes.SET_PARSED_URL](state: State, payload: LiveAtlasParsedUrl) {
|
||||||
state.parsedUrl = payload;
|
state.parsedUrl = payload;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -15,19 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DynmapComponentConfig,
|
DynmapComponentConfig, DynmapMarkerSet, DynmapMarkerSetUpdates,
|
||||||
DynmapWorldMap, DynmapMarkerSet, DynmapMarkerSetUpdates,
|
|
||||||
DynmapPlayer,
|
DynmapPlayer,
|
||||||
DynmapServerConfig, DynmapTileUpdate,
|
DynmapServerConfig, DynmapTileUpdate,
|
||||||
DynmapWorld, DynmapWorldState, Coordinate, DynmapParsedUrl, DynmapChat
|
DynmapChat
|
||||||
} from "@/dynmap";
|
} from "@/dynmap";
|
||||||
import {DynmapProjection} from "@/leaflet/projection/DynmapProjection";
|
import {DynmapProjection} from "@/leaflet/projection/DynmapProjection";
|
||||||
import {
|
import {
|
||||||
|
Coordinate, LiveAtlasWorldState,
|
||||||
LiveAtlasMessageConfig,
|
LiveAtlasMessageConfig,
|
||||||
LiveAtlasServerDefinition,
|
LiveAtlasServerDefinition,
|
||||||
LiveAtlasSidebarSection,
|
LiveAtlasSidebarSection,
|
||||||
LiveAtlasSortedPlayers,
|
LiveAtlasSortedPlayers,
|
||||||
LiveAtlasUIElement
|
LiveAtlasUIElement, LiveAtlasWorld, LiveAtlasWorldMap, LiveAtlasParsedUrl
|
||||||
} from "@/index";
|
} from "@/index";
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
@ -40,8 +40,8 @@ export type State = {
|
|||||||
|
|
||||||
loggedIn: boolean;
|
loggedIn: boolean;
|
||||||
|
|
||||||
worlds: Map<string, DynmapWorld>;
|
worlds: Map<string, LiveAtlasWorld>;
|
||||||
maps: Map<string, DynmapWorldMap>;
|
maps: Map<string, LiveAtlasWorldMap>;
|
||||||
players: Map<string, DynmapPlayer>;
|
players: Map<string, DynmapPlayer>;
|
||||||
sortedPlayers: LiveAtlasSortedPlayers;
|
sortedPlayers: LiveAtlasSortedPlayers;
|
||||||
markerSets: Map<string, DynmapMarkerSet>;
|
markerSets: Map<string, DynmapMarkerSet>;
|
||||||
@ -58,9 +58,9 @@ export type State = {
|
|||||||
panTarget?: DynmapPlayer;
|
panTarget?: DynmapPlayer;
|
||||||
|
|
||||||
currentServer?: LiveAtlasServerDefinition;
|
currentServer?: LiveAtlasServerDefinition;
|
||||||
currentWorldState: DynmapWorldState;
|
currentWorldState: LiveAtlasWorldState;
|
||||||
currentWorld?: DynmapWorld;
|
currentWorld?: LiveAtlasWorld;
|
||||||
currentMap?: DynmapWorldMap;
|
currentMap?: LiveAtlasWorldMap;
|
||||||
currentLocation: Coordinate;
|
currentLocation: Coordinate;
|
||||||
currentZoom: number;
|
currentZoom: number;
|
||||||
currentProjection: DynmapProjection;
|
currentProjection: DynmapProjection;
|
||||||
@ -78,7 +78,7 @@ export type State = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
parsedUrl: DynmapParsedUrl;
|
parsedUrl: LiveAtlasParsedUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const state: State = {
|
export const state: State = {
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import API from '@/api';
|
import API from '@/api';
|
||||||
import {DynmapPlayer, DynmapWorld, DynmapWorldMap} from "@/dynmap";
|
import {DynmapPlayer} from "@/dynmap";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
|
import {LiveAtlasWorld, LiveAtlasWorldMap} from "@/index";
|
||||||
|
|
||||||
interface HeadQueueEntry {
|
interface HeadQueueEntry {
|
||||||
cacheKey: string;
|
cacheKey: string;
|
||||||
@ -214,7 +215,7 @@ export const getAPI = () => {
|
|||||||
return API;
|
return API;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUrlForLocation = (world: DynmapWorld, map: DynmapWorldMap, location: {
|
export const getUrlForLocation = (world: LiveAtlasWorld, map: LiveAtlasWorldMap, location: {
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
z: number }, zoom: number): string => {
|
z: number }, zoom: number): string => {
|
||||||
@ -236,4 +237,4 @@ export const focus = (selector: string) => {
|
|||||||
if(element) {
|
if(element) {
|
||||||
(element as HTMLElement).focus();
|
(element as HTMLElement).focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user