Make image scaling in the slidecontroller and the display work correctly.

bzr-revno: 2890
This commit is contained in:
Tomas Groth 2019-08-22 07:43:22 -07:00 committed by Raoul Snyman
commit 323c56fefe
2 changed files with 7 additions and 2 deletions

View File

@ -426,9 +426,10 @@ var Display = {
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;

View File

@ -210,9 +210,13 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
pixmap = QtGui.QPixmap(str(slide['image']))
else:
pixmap = QtGui.QPixmap(str(slide['path']))
if pixmap.height() > 0:
pixmap_ratio = pixmap.width() / pixmap.height()
else:
pixmap_ratio = 1
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)