Disable player marker animations at high player counts
This commit is contained in:
parent
3573694df0
commit
76c5892c66
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import PlayerMarker from "@/components/map/marker/PlayerMarker.vue";
|
import PlayerMarker from "@/components/map/marker/PlayerMarker.vue";
|
||||||
import {defineComponent, computed} from "@vue/runtime-core";
|
import {defineComponent, computed, watch} from "@vue/runtime-core";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {LayerGroup} from 'leaflet';
|
import {LayerGroup} from 'leaflet';
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import DynmapMap from "@/leaflet/DynmapMap";
|
||||||
@ -38,15 +38,17 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setup(props) {
|
setup(props) {
|
||||||
props.leaflet.createPane('players');
|
|
||||||
|
|
||||||
const store = useStore(),
|
const store = useStore(),
|
||||||
|
playerPane = props.leaflet.createPane('players'),
|
||||||
players = computed(() => store.state.players),
|
players = computed(() => store.state.players),
|
||||||
|
playerCount = computed(() => store.state.players.size),
|
||||||
componentSettings = store.state.components.playerMarkers,
|
componentSettings = store.state.components.playerMarkers,
|
||||||
layerGroup = new LayerGroup([],{
|
layerGroup = new LayerGroup([],{
|
||||||
pane: 'players'
|
pane: 'players'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(playerCount, (newValue) => playerPane.classList.toggle('no-animations', newValue > 150))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
players,
|
players,
|
||||||
componentSettings,
|
componentSettings,
|
||||||
|
@ -327,6 +327,12 @@ button {
|
|||||||
display: block;
|
display: block;
|
||||||
outline: auto;
|
outline: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@at-root {
|
||||||
|
.no-animations .marker.marker--player {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
|
Loading…
Reference in New Issue
Block a user