Try to get image-scaling working correctly

This commit is contained in:
Tomas Groth 2019-08-19 22:42:36 +02:00
parent f7bcdcb67c
commit cd25766b79
2 changed files with 4 additions and 2 deletions

View File

@ -428,7 +428,8 @@ var Display = {
section.setAttribute("data-background", "#000"); section.setAttribute("data-background", "#000");
var img = document.createElement('img'); var img = document.createElement('img');
img.src = slide["path"]; 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); section.appendChild(img);
slidesDiv.appendChild(section); slidesDiv.appendChild(section);
Display._slides[index.toString()] = index; Display._slides[index.toString()] = index;

View File

@ -210,9 +210,10 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
pixmap = QtGui.QPixmap(str(slide['image'])) pixmap = QtGui.QPixmap(str(slide['image']))
else: else:
pixmap = QtGui.QPixmap(str(slide['path'])) pixmap = QtGui.QPixmap(str(slide['path']))
pixmap_ratio = pixmap.width() / pixmap.height()
label.setPixmap(pixmap) label.setPixmap(pixmap)
container = QtWidgets.QWidget() container = QtWidgets.QWidget()
layout = AspectRatioLayout(container, self.screen_ratio) layout = AspectRatioLayout(container, pixmap_ratio)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(label) layout.addWidget(label)
container.setLayout(layout) container.setLayout(layout)