From cd25766b79d5a4bc71da6af3fa6a66fa7c56446c Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 19 Aug 2019 22:42:36 +0200 Subject: [PATCH] Try to get image-scaling working correctly --- openlp/core/display/html/display.js | 3 ++- openlp/core/widgets/views.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index 56e3c0a48..203709e00 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -428,7 +428,8 @@ var Display = { section.setAttribute("data-background", "#000"); var img = document.createElement('img'); img.src = slide["path"]; - img.setAttribute("style", "height: 100%; width: 100%;"); + //img.setAttribute("style", "height: 100%; width: 100%;"); + img.setAttribute("style", "max-width: 100%; height: auto; vertical-align: middle"); section.appendChild(img); slidesDiv.appendChild(section); Display._slides[index.toString()] = index; diff --git a/openlp/core/widgets/views.py b/openlp/core/widgets/views.py index c3f4be0ca..e80e46cf4 100644 --- a/openlp/core/widgets/views.py +++ b/openlp/core/widgets/views.py @@ -210,9 +210,10 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties): pixmap = QtGui.QPixmap(str(slide['image'])) else: pixmap = QtGui.QPixmap(str(slide['path'])) + pixmap_ratio = pixmap.width() / pixmap.height() label.setPixmap(pixmap) container = QtWidgets.QWidget() - layout = AspectRatioLayout(container, self.screen_ratio) + layout = AspectRatioLayout(container, pixmap_ratio) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(label) container.setLayout(layout)