feat: rounded avatar editor

This commit is contained in:
Matthieu Bessat 2020-07-25 12:33:32 +02:00
parent 9d4cd6321c
commit 96bd968c33

View file

@ -7,10 +7,12 @@
{{ caption }} {{ caption }}
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-layout justify-center> <v-layout justify-center class="mb-4">
<div
:class="rounded ? 'rounded' : ''"
class="canvas-container">
<croppa <croppa
ref="croppa" ref="croppa"
class="canvas-container"
v-model="plugin" v-model="plugin"
canvas-color="white" canvas-color="white"
accept="image/jpeg,image/png" accept="image/jpeg,image/png"
@ -24,6 +26,12 @@
@file-type-mismatch="handleFileTypeMismatch" @file-type-mismatch="handleFileTypeMismatch"
placeholder="Choisissez une image" placeholder="Choisissez une image"
></croppa> ></croppa>
<!-- <div
v-if="rounded"
class="rounded-mask">
<div class="inside"></div>
</div> -->
</div>
</v-layout> </v-layout>
<v-layout justify-center> <v-layout justify-center>
<v-btn <v-btn
@ -104,6 +112,10 @@ export default {
loading: { loading: {
type: Boolean, type: Boolean,
default: false default: false
},
rounded: {
type: Boolean,
default: false
} }
}, },
methods: { methods: {
@ -154,9 +166,24 @@ export default {
.croppa-container { .croppa-container {
background: transparent !important; background: transparent !important;
} }
.canvas-container {
line-height: 0;
}
.canvas-container canvas { .canvas-container canvas {
border: 1px solid #bdc3c7; border: 1px solid #bdc3c7;
} }
/* .rounded-mask {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: 50%;
background-color: rgba(189, 195, 199, 0.5);
} */
.canvas-container.rounded .croppa-container canvas {
border-radius: 50% !important;
}
@media screen and (max-width: 959px) { @media screen and (max-width: 959px) {
.canvas-container canvas { .canvas-container canvas {
width: 100% !important; width: 100% !important;