Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Caption positioning

Manav Rathie15fb04ee0a4
diff --git a/web/apps/photos/src/styles/photoswipe.css b/web/apps/photos/src/styles/photoswipe.css
index 1b03c87e4f..dd072cc580 100644
--- a/web/apps/photos/src/styles/photoswipe.css
+++ b/web/apps/photos/src/styles/photoswipe.css
@@ -155,8 +155,8 @@
bottom: 0px;
right: 0;
margin: 20px 24px;
- padding: 6px 16px;
- border-radius: 2px;
+ padding: 8px 16px;
+ border-radius: 3px;
/* Same opacity as the other controls. */
color: rgb(255 255 255 / 0.85);
background-color: rgb(0 0 0 / 0.2);
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 901406b123..4bfae068b0 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -910,37 +910,38 @@ export class FileViewerPhotoSwipe {
});
ui.registerElement({
- name: "caption",
- // Arbitrary order towards the end (it doesn't matter anyways
- // since we're absolutely positioned).
+ name: "media-controls",
+ // Arbitrary order towards the end.
order: 30,
appendTo: "root",
- tagName: "p",
+ html: hlsVideoControlsHTML(),
onInit: (element, pswp) => {
- captionElement = element;
+ mediaControlsContainerElement = element;
pswp.on("change", () => {
- const { fileType, alt } = currSlideData();
- element.innerText = alt ?? "";
- element.style.visibility = alt ? "visible" : "hidden";
- // Add extra offset for video captions so that they do
- // not overlap with the video controls. The constant is
- // an ad-hoc value that looked okay-ish across browsers.
- element.style.bottom =
- fileType === FileType.video ? "36px" : "0";
+ const { mediaControllerID } = currSlideData();
+ updateMediaControls(mediaControllerID);
});
},
});
ui.registerElement({
- name: "media-controls",
+ name: "caption",
+ // After the video controls so that we don't get occluded by
+ // them (nb: the caption will hide when the video is playing).
order: 31,
appendTo: "root",
- html: hlsVideoControlsHTML(),
+ tagName: "p",
onInit: (element, pswp) => {
- mediaControlsContainerElement = element;
+ captionElement = element;
pswp.on("change", () => {
- const { mediaControllerID } = currSlideData();
- updateMediaControls(mediaControllerID);
+ const { fileType, alt } = currSlideData();
+ element.innerText = alt ?? "";
+ element.style.visibility = alt ? "visible" : "hidden";
+ // Add extra offset for video captions so that they do
+ // not overlap with the video controls. The constant is
+ // such that it lies above the media controls.
+ element.style.bottom =
+ fileType === FileType.video ? "44px" : "0";
});
},
});