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