openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #34462
[Merge] lp:~tomasgroth/openlp/image-scaling into lp:openlp
Tomas Groth has proposed merging lp:~tomasgroth/openlp/image-scaling into lp:openlp.
Commit message:
Make image scaling in the slidecontroller and the display work correctly.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/image-scaling/+merge/371606
--
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/image-scaling into lp:openlp.
=== modified file 'openlp/core/display/html/display.js'
--- openlp/core/display/html/display.js 2019-08-06 21:46:00 +0000
+++ openlp/core/display/html/display.js 2019-08-21 19:22:35 +0000
@@ -426,9 +426,10 @@
var section = document.createElement("section");
section.setAttribute("id", index);
section.setAttribute("data-background", "#000");
+ section.setAttribute("style", "height: 100%; width: 100%;");
var img = document.createElement('img');
img.src = slide["path"];
- img.setAttribute("style", "height: 100%; width: 100%;");
+ img.setAttribute("style", "max-width: 100%; height: auto; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);");
section.appendChild(img);
slidesDiv.appendChild(section);
Display._slides[index.toString()] = index;
=== modified file 'openlp/core/widgets/views.py'
--- openlp/core/widgets/views.py 2019-07-03 13:23:23 +0000
+++ openlp/core/widgets/views.py 2019-08-21 19:22:35 +0000
@@ -210,9 +210,10 @@
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)
Follow ups