mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 05:37:50 -06:00
Merge pull request #2200 from fieldOfView/fix_monitoritem_size
Adapt camera image to available space
This commit is contained in:
parent
da8b55cf62
commit
3116ff829c
3 changed files with 19 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue