mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 13:47:51 -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
|
@ -144,6 +144,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
return self._control_item
|
return self._control_item
|
||||||
|
|
||||||
def _createControlViewFromQML(self):
|
def _createControlViewFromQML(self):
|
||||||
|
if not self._control_view_qml_path:
|
||||||
|
return
|
||||||
|
|
||||||
path = QUrl.fromLocalFile(self._control_view_qml_path)
|
path = QUrl.fromLocalFile(self._control_view_qml_path)
|
||||||
|
|
||||||
# Because of garbage collection we need to keep this referenced by python.
|
# Because of garbage collection we need to keep this referenced by python.
|
||||||
|
|
|
@ -9,9 +9,20 @@ Component
|
||||||
Image
|
Image
|
||||||
{
|
{
|
||||||
id: cameraImage
|
id: cameraImage
|
||||||
width: sourceSize.width
|
property bool proportionalHeight:
|
||||||
height: sourceSize.height * width / sourceSize.width
|
{
|
||||||
|
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
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
onVisibleChanged:
|
onVisibleChanged:
|
||||||
{
|
{
|
||||||
if(visible)
|
if(visible)
|
||||||
|
|
|
@ -466,6 +466,9 @@ UM.MainWindow
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
|
anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
|
||||||
|
anchors.verticalCenterOffset: UM.Theme.getSize("sidebar_header").height / 2
|
||||||
|
property real maximumWidth: viewportOverlay.width
|
||||||
|
property real maximumHeight: viewportOverlay.height
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.MessageStack
|
UM.MessageStack
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue