forked from openlp/openlp
Make image scaling in the slidecontroller and the display work correctly.
bzr-revno: 2890
This commit is contained in:
commit
323c56fefe
@ -426,9 +426,10 @@ var Display = {
|
|||||||
var section = document.createElement("section");
|
var section = document.createElement("section");
|
||||||
section.setAttribute("id", index);
|
section.setAttribute("id", index);
|
||||||
section.setAttribute("data-background", "#000");
|
section.setAttribute("data-background", "#000");
|
||||||
|
section.setAttribute("style", "height: 100%; width: 100%;");
|
||||||
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", "max-width: 100%; height: auto; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);");
|
||||||
section.appendChild(img);
|
section.appendChild(img);
|
||||||
slidesDiv.appendChild(section);
|
slidesDiv.appendChild(section);
|
||||||
Display._slides[index.toString()] = index;
|
Display._slides[index.toString()] = index;
|
||||||
|
@ -210,9 +210,13 @@ 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']))
|
||||||
|
if pixmap.height() > 0:
|
||||||
|
pixmap_ratio = pixmap.width() / pixmap.height()
|
||||||
|
else:
|
||||||
|
pixmap_ratio = 1
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user