Make image in overlay fit into viewer again

This commit is contained in:
Nicolas Werner 2024-03-06 20:52:58 +01:00
parent b3c78ea81a
commit 05e36dd007
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -51,8 +51,10 @@ Window {
property int imgSrcWidth: (imageOverlay.originalWidth && imageOverlay.originalWidth > 100) ? imageOverlay.originalWidth : Screen.width property int imgSrcWidth: (imageOverlay.originalWidth && imageOverlay.originalWidth > 100) ? imageOverlay.originalWidth : Screen.width
property int imgSrcHeight: imageOverlay.proportionalHeight ? imgSrcWidth * imageOverlay.proportionalHeight : Screen.height property int imgSrcHeight: imageOverlay.proportionalHeight ? imgSrcWidth * imageOverlay.proportionalHeight : Screen.height
height: imgSrcHeight property double initialScale: Math.min(Window.height/imgSrcHeight, Window.width/imgSrcWidth, 1.0)
width: imgSrcWidth
height: imgSrcHeight * initialScale
width: imgSrcWidth * initialScale
x: (parent.width - width) / 2 x: (parent.width - width) / 2
y: (parent.height - height) / 2 y: (parent.height - height) / 2
@ -79,6 +81,11 @@ Window {
play: !Settings.animateImagesOnHover || mouseArea.hovered play: !Settings.animateImagesOnHover || mouseArea.hovered
eventId: imageOverlay.eventId eventId: imageOverlay.eventId
} }
Text {
anchors.centerIn: parent
text: "Orig width: " + imageOverlay.proportionalHeight
}
onScaleChanged: { onScaleChanged: {
if (scale > 10) scale = 10; if (scale > 10) scale = 10;