screenshot fixes

This commit is contained in:
Steffen 2020-04-22 21:21:54 +02:00
parent be44e977eb
commit b6b33c10e9
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
5 changed files with 71 additions and 17 deletions

View File

@ -1,5 +1,10 @@
<template> <template>
<div id="app" @keyup="keyup" tabindex="-1"> <div
id="app"
@keyup="keyup"
tabindex="-1"
v-bind:class="{ screenshot: isScreenshot }"
>
<TownInfo :players="players" :edition="edition"></TownInfo> <TownInfo :players="players" :edition="edition"></TownInfo>
<TownSquare <TownSquare
:is-public="isPublic" :is-public="isPublic"
@ -37,7 +42,8 @@
<Screenshot <Screenshot
ref="screenshot" ref="screenshot"
@success="isScreenshotSuccess = true" @success="onScreenshot(true)"
@error="onScreenshot(false)"
></Screenshot> ></Screenshot>
<div class="controls"> <div class="controls">
@ -103,6 +109,7 @@ export default {
isEditionModalOpen: false, isEditionModalOpen: false,
isRoleModalOpen: false, isRoleModalOpen: false,
isScreenshotSuccess: false, isScreenshotSuccess: false,
isScreenshot: false,
players: [], players: [],
roles: this.getRolesByEdition(), roles: this.getRolesByEdition(),
edition: "tb", edition: "tb",
@ -113,8 +120,13 @@ export default {
takeScreenshot(dimensions = {}) { takeScreenshot(dimensions = {}) {
this.isControlOpen = false; this.isControlOpen = false;
this.isScreenshotSuccess = false; this.isScreenshotSuccess = false;
this.isScreenshot = true;
this.$refs.screenshot.capture(dimensions); this.$refs.screenshot.capture(dimensions);
}, },
onScreenshot(success = false) {
this.isScreenshotSuccess = success;
this.isScreenshot = false;
},
togglePublic() { togglePublic() {
this.isPublic = !this.isPublic; this.isPublic = !this.isPublic;
this.isControlOpen = false; this.isControlOpen = false;

View File

@ -59,6 +59,10 @@ export default {
isPublic: { isPublic: {
type: Boolean, type: Boolean,
required: true required: true
},
zoom: {
type: Number,
required: true
} }
}, },
data() { data() {
@ -67,7 +71,12 @@ export default {
methods: { methods: {
takeScreenshot() { takeScreenshot() {
const { width, height, x, y } = this.$refs.player.getBoundingClientRect(); const { width, height, x, y } = this.$refs.player.getBoundingClientRect();
this.$emit("screenshot", { width, height, x, y }); this.$emit("screenshot", {
width: width * this.zoom,
height: height * this.zoom,
x: x * this.zoom,
y: y * this.zoom
});
}, },
toggleStatus() { toggleStatus() {
if (this.isPublic) { if (this.isPublic) {
@ -147,9 +156,6 @@ export default {
top: 0; top: 0;
transform: perspective(400px) scale(1); transform: perspective(400px) scale(1);
} }
&.dead > .name {
opacity: 0.5;
}
} }
/****** Life token *******/ /****** Life token *******/
@ -213,9 +219,8 @@ export default {
/***** Role token ******/ /***** Role token ******/
.player .token { .player .token {
position: absolute; position: absolute;
left: 50%; left: 0;
top: 0; top: 0;
margin-left: ($token + 6) / -2;
height: $token + 6px; height: $token + 6px;
width: $token + 6px; width: $token + 6px;
transition: transform 200ms ease-in-out; transition: transform 200ms ease-in-out;
@ -235,15 +240,29 @@ export default {
drop-shadow(0 0 1px rgba(0, 0, 0, 1)) drop-shadow(0 0 1px rgba(0, 0, 0, 1)); drop-shadow(0 0 1px rgba(0, 0, 0, 1)) drop-shadow(0 0 1px rgba(0, 0, 0, 1));
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
width: 100%;
display: flex;
justify-content: center;
span.screenshot, span.screenshot,
span.remove { span.remove {
display: none; display: none;
margin: 0 10px; margin: 0 5px;
flex-shrink: 0;
flex-grow: 0;
#app.screenshot & {
display: none;
}
}
span.name {
flex-shrink: 1;
text-overflow: ellipsis;
overflow: hidden;
} }
&:hover { &:hover {
color: red; color: red;
span { span {
display: inline-block; display: block;
color: white; color: white;
&:hover { &:hover {
color: red; color: red;
@ -252,6 +271,10 @@ export default {
} }
} }
.player.dead > .name {
opacity: 0.5;
}
/***** Ability text *****/ /***** Ability text *****/
#townsquare.public .ability { #townsquare.public .ability {
display: none; display: none;

View File

@ -129,6 +129,10 @@ export default {
margin-right: 2px; margin-right: 2px;
right: 100%; right: 100%;
} }
#app.screenshot & {
display: none;
}
} }
.name { .name {

View File

@ -12,6 +12,7 @@
:player="player" :player="player"
:roles="roles" :roles="roles"
:is-public="isPublic" :is-public="isPublic"
:zoom="zoom"
@add-reminder="openReminderModal" @add-reminder="openReminderModal"
@set-role="openRoleModal" @set-role="openRoleModal"
@remove-player="removePlayer" @remove-player="removePlayer"
@ -231,6 +232,19 @@ export default {
.shroud { .shroud {
transition-delay: ($i - 1) * 50ms; transition-delay: ($i - 1) * 50ms;
} }
// move reminders closer to the sides of the circle
$q: $item-count / 4;
$x: $i - 1;
@if $x < $q or ($x >= $item-count / 2 and $x < $q * 3) {
.player {
margin-bottom: -10px + 20px * (1 - ($x % $q / $q));
}
} @else {
.player {
margin-bottom: -10px + 20px * ($x % $q / $q);
}
}
} }
$rot: $rot + $angle; $rot: $rot + $angle;
} }
@ -262,6 +276,11 @@ export default {
transform: scale(1); transform: scale(1);
opacity: 1; opacity: 1;
transition: all 200ms ease-in-out; transition: all 200ms ease-in-out;
#townsquare.public & {
opacity: 0;
transform: scale(0.1);
}
> svg { > svg {
position: absolute; position: absolute;
top: 10px; top: 10px;
@ -270,6 +289,9 @@ export default {
&:hover { &:hover {
color: red; color: red;
} }
#app.screenshot & {
display: none;
}
} }
h3 { h3 {
margin-top: 5px; margin-top: 5px;
@ -282,12 +304,6 @@ export default {
font-size: 18px; font-size: 18px;
} }
} }
#townsquare.public .bluffs {
opacity: 0;
transform: scale(0.1);
}
/***** Role token modal ******/ /***** Role token modal ******/
ul.tokens li { ul.tokens li {
border-radius: 50%; border-radius: 50%;

View File

@ -110,4 +110,3 @@ $roles:
'widow', 'widow',
'leviathan' 'leviathan'
; ;