forked from platypush/platypush
[Camera UI] Don't overflow the screen size.
This commit is contained in:
parent
579f9816e2
commit
8291a97cd9
2 changed files with 50 additions and 13 deletions
|
@ -113,18 +113,10 @@ export default {
|
||||||
const rot = degToRad(this.params.rotate)
|
const rot = degToRad(this.params.rotate)
|
||||||
const outerWidth = this.$refs.frameContainer.parentElement.offsetWidth
|
const outerWidth = this.$refs.frameContainer.parentElement.offsetWidth
|
||||||
const outerHeight = this.$refs.frameContainer.parentElement.offsetHeight
|
const outerHeight = this.$refs.frameContainer.parentElement.offsetHeight
|
||||||
|
const maxWidth = this.$refs.cameraRoot?.offsetWidth || outerWidth
|
||||||
let width = (
|
const maxHeight = this.$refs.cameraRoot?.offsetHeight || outerHeight
|
||||||
Math.round(
|
let width = '100%'
|
||||||
this.params.scale_x * Math.abs(this.params.resolution[0] * Math.cos(rot) + this.params.resolution[1] * Math.sin(rot))
|
let height = '100%'
|
||||||
) + 'px'
|
|
||||||
)
|
|
||||||
|
|
||||||
let height = (
|
|
||||||
Math.round(
|
|
||||||
this.params.scale_y * Math.abs(this.params.resolution[0] * Math.sin(rot) + this.params.resolution[1] * Math.cos(rot))
|
|
||||||
) + 'px'
|
|
||||||
)
|
|
||||||
|
|
||||||
if (this.fullscreen_) {
|
if (this.fullscreen_) {
|
||||||
if (this.params.resolution[0] > this.params.resolution[1]) {
|
if (this.params.resolution[0] > this.params.resolution[1]) {
|
||||||
|
@ -134,6 +126,20 @@ export default {
|
||||||
height = '100%'
|
height = '100%'
|
||||||
width = (outerWidth * (this.params.resolution[0] / this.params.resolution[1])) + 'px'
|
width = (outerWidth * (this.params.resolution[0] / this.params.resolution[1])) + 'px'
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
width = Math.min(
|
||||||
|
maxWidth,
|
||||||
|
Math.round(
|
||||||
|
this.params.scale_x * Math.abs(this.params.resolution[0] * Math.cos(rot) + this.params.resolution[1] * Math.sin(rot))
|
||||||
|
)
|
||||||
|
) + 'px'
|
||||||
|
|
||||||
|
height = Math.min(
|
||||||
|
maxHeight,
|
||||||
|
Math.round(
|
||||||
|
this.params.scale_y * Math.abs(this.params.resolution[0] * Math.sin(rot) + this.params.resolution[1] * Math.cos(rot))
|
||||||
|
)
|
||||||
|
) + 'px'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$refs.frameContainer.style.width = width
|
this.$refs.frameContainer.style.width = width
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
$camera-background: #101520;
|
$camera-background: #101520;
|
||||||
|
$controls-height: 3.5em;
|
||||||
|
|
||||||
.camera {
|
.camera {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -9,6 +10,7 @@ $camera-background: #101520;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-top: 3em;
|
padding-top: 3em;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.camera-container {
|
.camera-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -16,8 +18,32 @@ $camera-background: #101520;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: $camera-background;
|
background: $camera-background;
|
||||||
|
|
||||||
.frame-container {
|
.frame-canvas {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame-container {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fullscreen {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 1000;
|
||||||
|
|
||||||
|
.frame-canvas {
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100% - #{$controls-height});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.frame, .no-frame {
|
.frame, .no-frame {
|
||||||
|
@ -42,6 +68,7 @@ $camera-background: #101520;
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: $controls-height;
|
||||||
display: flex;
|
display: flex;
|
||||||
border-top: 1px solid #202530;
|
border-top: 1px solid #202530;
|
||||||
padding: .5em .25em;
|
padding: .5em .25em;
|
||||||
|
@ -146,6 +173,10 @@ $camera-background: #101520;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-container {
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
.content {
|
.content {
|
||||||
@media screen and (max-width: calc(#{$tablet} - 1px)) {
|
@media screen and (max-width: calc(#{$tablet} - 1px)) {
|
||||||
|
|
Loading…
Reference in a new issue