mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 02:19:04 +08:00
Resize camera image to fit small windows if necessary
This commit is contained in:
parent
e5b52793b0
commit
d6d4617356
@ -9,9 +9,20 @@ Component
|
||||
Image
|
||||
{
|
||||
id: cameraImage
|
||||
width: sourceSize.width
|
||||
height: sourceSize.height * width / sourceSize.width
|
||||
property bool proportionalHeight:
|
||||
{
|
||||
if(sourceSize.height == 0 || maximumHeight == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (sourceSize.width / sourceSize.height) > (maximumWidth / maximumHeight);
|
||||
}
|
||||
property real _width: Math.min(maximumWidth, sourceSize.width)
|
||||
property real _height: Math.min(maximumHeight, sourceSize.height)
|
||||
width: proportionalHeight ? _width : sourceSize.width * _height / sourceSize.height
|
||||
height: !proportionalHeight ? _height : sourceSize.height * _width / sourceSize.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
onVisibleChanged:
|
||||
{
|
||||
if(visible)
|
||||
|
@ -466,6 +466,8 @@ UM.MainWindow
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
|
||||
property real maximumWidth: viewportOverlay.width
|
||||
property real maximumHeight: viewportOverlay.height
|
||||
}
|
||||
|
||||
UM.MessageStack
|
||||
|
Loading…
x
Reference in New Issue
Block a user