summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-03-06 20:52:58 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2024-03-06 20:52:58 +0100
commit05e36dd007d87ba2f396d4e9e479c4e62571eeb0 (patch)
treeac0661066b22e5d4a12cee0b81874dd413263d1d /resources/qml
parentFix animated images rendering offscreen for the first frame (diff)
downloadnheko-05e36dd007d87ba2f396d4e9e479c4e62571eeb0.tar.xz
Make image in overlay fit into viewer again
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/dialogs/ImageOverlay.qml11
1 files changed, 9 insertions, 2 deletions
diff --git a/resources/qml/dialogs/ImageOverlay.qml b/resources/qml/dialogs/ImageOverlay.qml
index 69a80eb3..079f3b4f 100644
--- a/resources/qml/dialogs/ImageOverlay.qml
+++ b/resources/qml/dialogs/ImageOverlay.qml
@@ -51,8 +51,10 @@ Window {
         property int imgSrcWidth: (imageOverlay.originalWidth && imageOverlay.originalWidth > 100) ? imageOverlay.originalWidth : Screen.width
         property int imgSrcHeight: imageOverlay.proportionalHeight ? imgSrcWidth * imageOverlay.proportionalHeight : Screen.height
 
-        height: imgSrcHeight
-        width: imgSrcWidth
+        property double initialScale: Math.min(Window.height/imgSrcHeight, Window.width/imgSrcWidth, 1.0)
+
+        height: imgSrcHeight * initialScale
+        width: imgSrcWidth * initialScale
 
         x: (parent.width - width) / 2
         y: (parent.height - height) / 2
@@ -79,6 +81,11 @@ Window {
             play: !Settings.animateImagesOnHover || mouseArea.hovered
             eventId: imageOverlay.eventId
         }
+        Text {
+            anchors.centerIn: parent
+            text: "Orig width: " + imageOverlay.proportionalHeight
+        }
+
 
         onScaleChanged: {
             if (scale > 10) scale = 10;