mirror of https://github.com/bra1n/townsquare.git
fix bug with zoom and roleselection
This commit is contained in:
parent
7d8c8878ff
commit
8856cefe27
|
@ -121,7 +121,7 @@ export default {
|
||||||
this.isControlOpen = false;
|
this.isControlOpen = false;
|
||||||
this.isScreenshotSuccess = false;
|
this.isScreenshotSuccess = false;
|
||||||
this.isScreenshot = true;
|
this.isScreenshot = true;
|
||||||
this.$refs.screenshot.capture(dimensions);
|
this.$refs.screenshot.capture(dimensions, this.zoom);
|
||||||
},
|
},
|
||||||
onScreenshot(success = false) {
|
onScreenshot(success = false) {
|
||||||
this.isScreenshotSuccess = success;
|
this.isScreenshotSuccess = success;
|
||||||
|
|
|
@ -69,10 +69,6 @@ export default {
|
||||||
isPublic: {
|
isPublic: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: true
|
required: true
|
||||||
},
|
|
||||||
zoom: {
|
|
||||||
type: Number,
|
|
||||||
required: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -81,12 +77,7 @@ 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", {
|
this.$emit("screenshot", { width, height, x, y });
|
||||||
width: width * this.zoom,
|
|
||||||
height: height * this.zoom,
|
|
||||||
x: x * this.zoom,
|
|
||||||
y: y * this.zoom
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
toggleStatus() {
|
toggleStatus() {
|
||||||
if (this.isPublic) {
|
if (this.isPublic) {
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<Modal class="roles" v-show="isOpen" @close="close()">
|
<Modal
|
||||||
|
class="roles"
|
||||||
|
v-show="isOpen"
|
||||||
|
@close="close()"
|
||||||
|
v-if="nontravelerPlayers >= 5"
|
||||||
|
>
|
||||||
<h3>Select the roles for {{ nontravelerPlayers }} players:</h3>
|
<h3>Select the roles for {{ nontravelerPlayers }} players:</h3>
|
||||||
<ul
|
<ul
|
||||||
class="tokens"
|
class="tokens"
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async capture({ x, y, width, height }) {
|
async capture({ x = 0, y = 0, width = 0, height = 0 }, zoom = 1) {
|
||||||
const canvas = this.$refs.canvas;
|
const canvas = this.$refs.canvas;
|
||||||
const video = this.$refs.video;
|
const video = this.$refs.video;
|
||||||
// start capturing
|
// start capturing
|
||||||
|
@ -39,18 +39,18 @@ export default {
|
||||||
video.play();
|
video.play();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const context = canvas.getContext("2d");
|
const context = canvas.getContext("2d");
|
||||||
canvas.setAttribute("width", width || video.videoWidth);
|
canvas.setAttribute("width", width * zoom || video.videoWidth);
|
||||||
canvas.setAttribute("height", height || video.videoHeight);
|
canvas.setAttribute("height", height * zoom || video.videoHeight);
|
||||||
context.drawImage(
|
context.drawImage(
|
||||||
video,
|
video,
|
||||||
x || 0,
|
x * zoom || 0,
|
||||||
y || 0,
|
y * zoom || 0,
|
||||||
width || video.videoWidth,
|
width * zoom || video.videoWidth,
|
||||||
height || video.videoHeight,
|
height * zoom || video.videoHeight,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
width || video.videoWidth,
|
width * zoom || video.videoWidth,
|
||||||
height || video.videoHeight
|
height * zoom || video.videoHeight
|
||||||
);
|
);
|
||||||
canvas.toBlob(blob => {
|
canvas.toBlob(blob => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
: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"
|
||||||
|
|
Loading…
Reference in New Issue