fix(video): 修正锚点弹层定位偏移到右下角
This commit is contained in:
1 parent
cf34ad5f5b
commit
07deb226b7
3 files changed
+13
-3
No files matched your search
@@ -674,6 +674,12 @@ body {
|
||||
|
||||
#cacheVideoModal .modal-content {
|
||||
position: fixed;
|
||||
left: 12px;
|
||||
top: 12px;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
margin: 0;
|
||||
transform: none;
|
||||
width: min(560px, calc(100vw - 24px));
|
||||
max-height: min(72vh, 560px);
|
||||
border-radius: 12px;
|
||||
|
||||
@@ -1100,12 +1100,15 @@
|
||||
if (!(content instanceof HTMLElement)) return;
|
||||
const anchor = cacheModalAnchorEl instanceof HTMLElement ? cacheModalAnchorEl : null;
|
||||
if (!anchor) return;
|
||||
content.style.right = 'auto';
|
||||
content.style.bottom = 'auto';
|
||||
content.style.transform = 'none';
|
||||
const rect = anchor.getBoundingClientRect();
|
||||
const margin = 8;
|
||||
const vw = window.innerWidth || document.documentElement.clientWidth || 0;
|
||||
const vh = window.innerHeight || document.documentElement.clientHeight || 0;
|
||||
const width = Math.min(560, Math.max(280, vw - 24));
|
||||
let left = rect.left;
|
||||
let left = rect.left + (rect.width / 2) - (width / 2);
|
||||
if (left + width > vw - 12) {
|
||||
left = vw - 12 - width;
|
||||
}
|
||||
@@ -1125,6 +1128,7 @@
|
||||
cacheVideoModal.classList.remove('hidden');
|
||||
cacheVideoModal.classList.add('is-open');
|
||||
positionCacheVideoModal();
|
||||
requestAnimationFrame(() => positionCacheVideoModal());
|
||||
}
|
||||
|
||||
function closeCacheVideoModal() {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
|
||||
<script src="/static/common/js/theme.js?v=0.1.0"></script>
|
||||
<link href="/static/common/css/common.css?v=0.3.7" rel="stylesheet">
|
||||
<link href="/static/public/css/video.css?v=0.4.1" rel="stylesheet">
|
||||
<link href="/static/public/css/video.css?v=0.4.2" rel="stylesheet">
|
||||
<link href="/static/common/css/toast.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
<script src="/static/common/js/pwa.js?v=0.1.1"></script>
|
||||
<script src="/static/vendor/ffmpeg/ffmpeg.js?v=0.1.0"></script>
|
||||
<script src="/static/vendor/ffmpeg/ffmpeg-util.js?v=0.1.0"></script>
|
||||
<script src="/static/public/js/video.js?v=0.5.3"></script>
|
||||
<script src="/static/public/js/video.js?v=0.5.4"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user