fixed travelers, added zoom

This commit is contained in:
Steffen 2020-04-15 17:30:26 +02:00
parent b7d8023137
commit 7bdba2b5d3
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
6 changed files with 32 additions and 13 deletions

View File

@ -5,6 +5,7 @@
:is-public="isPublic"
:players="players"
:roles="roles"
:zoom="zoom"
></TownSquare>
<Modal
@ -37,6 +38,12 @@
<font-awesome-icon icon="cogs" @click="isControlOpen = !isControlOpen" />
<ul v-if="isControlOpen">
<li @click="togglePublic">Toggle <em>G</em>rimoire</li>
<li>
Size
<font-awesome-icon @click="zoom -= 0.1" icon="search-minus" />
{{ Math.round(zoom * 100) }}%
<font-awesome-icon @click="zoom += 0.1" icon="search-plus" />
</li>
<li @click="addPlayer" v-if="players.length < 20">
<em>A</em>dd Player
</li>
@ -84,7 +91,8 @@ export default {
isRoleModalOpen: false,
players: [],
roles: this.getRolesByEdition(),
edition: "tb"
edition: "tb",
zoom: 1
};
},
methods: {

View File

@ -169,10 +169,6 @@ export default {
}
&.dead {
&.traveler {
filter: grayscale(100%);
}
&.no-vote .life:after {
display: none;
}
@ -193,6 +189,10 @@ export default {
}
}
}
&.traveler .life {
filter: grayscale(100%);
}
}
#townsquare.public .player {

View File

@ -61,8 +61,10 @@ export default {
},
computed: {
nontravelerPlayers: function() {
return this.players.filter(({ role }) => role && role.team !== "traveler")
.length;
return Math.min(
this.players.filter(({ role }) => role && role.team !== "traveler").length,
15
);
},
selectedRoles: function() {
return Object.values(this.roleSelection)

View File

@ -52,9 +52,10 @@ export default {
},
computed: {
teams: function() {
const nontravelers = this.players.filter(
player => player.role.team !== "traveler"
).length;
const nontravelers = Math.min(
this.players.filter(player => player.role.team !== "traveler").length,
15
);
const alive = this.players.filter(player => player.hasDied !== true)
.length;
return {

View File

@ -1,5 +1,5 @@
<template>
<div id="townsquare" class="square" v-bind:class="{ public: isPublic }">
<div id="townsquare" class="square" v-bind:class="{ public: isPublic }" v-bind:style="{ zoom: zoom }">
<ul class="circle" v-bind:class="['size-' + players.length]">
<Player
v-for="(player, index) in players"
@ -64,6 +64,10 @@ export default {
roles: {
type: Map,
required: true
},
zoom: {
type: Number,
required: true
}
},
data() {

View File

@ -8,7 +8,9 @@ import {
faUserFriends,
faUser,
faTimesCircle,
faCogs
faCogs,
faSearchMinus,
faSearchPlus
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
@ -19,7 +21,9 @@ library.add(
faUserFriends,
faUser,
faTimesCircle,
faCogs
faCogs,
faSearchMinus,
faSearchPlus
);
Vue.component("font-awesome-icon", FontAwesomeIcon);