Make images fullscreen

This commit is contained in:
Daniel Martin 2021-01-30 05:02:57 +00:00 committed by Raoul Snyman
parent c7112a1f78
commit 837b62ce39
2 changed files with 3 additions and 3 deletions

View File

@ -654,7 +654,7 @@ var Display = {
section.setAttribute("style", "height: 100%; width: 100%;"); 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", "max-width: 100%; max-height: 100%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"); img.setAttribute("style", "width: 100%; height: 100%; margin: 0; object-fit: contain;");
section.appendChild(img); section.appendChild(img);
parentSection.appendChild(section); parentSection.appendChild(section);
Display._slides[index.toString()] = index; Display._slides[index.toString()] = index;

View File

@ -772,9 +772,9 @@ describe("Display.setImageSlides", function () {
expect($(".slides > section > section").length).toEqual(2); expect($(".slides > section > section").length).toEqual(2);
expect($(".slides > section > section > img").length).toEqual(2); expect($(".slides > section > section > img").length).toEqual(2);
expect($(".slides > section > section > img")[0].getAttribute("src")).toEqual("file:///openlp1.jpg") expect($(".slides > section > section > img")[0].getAttribute("src")).toEqual("file:///openlp1.jpg")
expect($(".slides > section > section > img")[0].getAttribute("style")).toEqual("max-width: 100%; max-height: 100%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);") expect($(".slides > section > section > img")[0].getAttribute("style")).toEqual("width: 100%; height: 100%; margin: 0; object-fit: contain;")
expect($(".slides > section > section > img")[1].getAttribute("src")).toEqual("file:///openlp2.jpg") expect($(".slides > section > section > img")[1].getAttribute("src")).toEqual("file:///openlp2.jpg")
expect($(".slides > section > section > img")[1].getAttribute("style")).toEqual("max-width: 100%; max-height: 100%; margin: 0; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);") expect($(".slides > section > section > img")[1].getAttribute("style")).toEqual("width: 100%; height: 100%; margin: 0; object-fit: contain;")
expect(Reveal.sync).toHaveBeenCalledTimes(1); expect(Reveal.sync).toHaveBeenCalledTimes(1);
}); });
}); });