mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2024-11-08 09:11:52 +00:00
feat(capture preview): Rescale on screen resize
This commit is contained in:
parent
69e31c3304
commit
7dbdc405a2
5 changed files with 23 additions and 4 deletions
|
@ -9,5 +9,6 @@
|
|||
flex-grow: 1;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
max-width: 32rem;
|
||||
max-width: calc(100% - 2rem);
|
||||
width: 32rem;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Progress bar
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.download-btn,
|
||||
|
|
|
@ -24,6 +24,12 @@ import { mapState } from 'vuex'
|
|||
|
||||
export default {
|
||||
name: 'capture',
|
||||
data () {
|
||||
return {
|
||||
loadListener: null,
|
||||
resizeListener: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
captureOptions,
|
||||
captureProgress,
|
||||
|
@ -84,11 +90,21 @@ export default {
|
|||
},
|
||||
mounted: function () {
|
||||
this.$refs.preview.srcObject = this.mediaStream
|
||||
|
||||
this.getpreviewcontainerSquare()
|
||||
this.$refs.preview.addEventListener('resize', ev => {
|
||||
|
||||
// On load
|
||||
this.loadListener = this.$refs.preview.addEventListener('resize', () => {
|
||||
this.applyScaling()
|
||||
}, false)
|
||||
// On window resize
|
||||
this.resizeListener = window.addEventListener('resize', () => {
|
||||
this.getpreviewcontainerSquare()
|
||||
this.applyScaling()
|
||||
}, false)
|
||||
},
|
||||
destroyed: function () {
|
||||
this.loadListener = null
|
||||
this.resizeListener = null
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<button class="options__btn" @click="back">← back</button>
|
||||
</div>
|
||||
|
||||
<div class="preview">
|
||||
<div class="preview" ref="previewcontainer">
|
||||
<img class="preview-visualImg" :src="downloading.objectUrl" alt="">
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue