Mobile: hide volume, add PDF zoom +/- buttons, fix zoom scroll position
- Hide volume label/slider/input on mobile (≤600px) - Add − and + buttons flanking the PDF zoom slider - Preserve scroll fraction across zoom changes in PDF scroll mode Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1bda59e3fc
commit
aff4f5aef2
2 changed files with 27 additions and 7 deletions
|
|
@ -734,8 +734,10 @@ a:hover {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.volume-slider {
|
.volume-label,
|
||||||
width: 60px;
|
.volume-slider,
|
||||||
|
.volume-num {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.affiliate-section {
|
.affiliate-section {
|
||||||
|
|
|
||||||
|
|
@ -3554,7 +3554,7 @@ function toggleSettingsPanel() {
|
||||||
`;
|
`;
|
||||||
} else {
|
} else {
|
||||||
panel.innerHTML = `
|
panel.innerHTML = `
|
||||||
<label>Zoom <input type="range" id="rs-zoom" min="50" max="200" step="10" value="${readerSettings.pdfZoom}"> <span id="rs-zoom-val">${readerSettings.pdfZoom}%</span></label>
|
<label>Zoom <button class="btn btn-sm" id="rs-zoom-minus">−</button> <input type="range" id="rs-zoom" min="50" max="200" step="10" value="${readerSettings.pdfZoom}"> <button class="btn btn-sm" id="rs-zoom-plus">+</button> <span id="rs-zoom-val">${readerSettings.pdfZoom}%</span></label>
|
||||||
<button class="btn btn-sm ${readerSettings.pdfInverted ? 'active' : ''}" id="rs-invert">Invert</button>
|
<button class="btn btn-sm ${readerSettings.pdfInverted ? 'active' : ''}" id="rs-invert">Invert</button>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
@ -3608,17 +3608,35 @@ function toggleSettingsPanel() {
|
||||||
} else {
|
} else {
|
||||||
const zoomRange = panel.querySelector('#rs-zoom');
|
const zoomRange = panel.querySelector('#rs-zoom');
|
||||||
const zoomVal = panel.querySelector('#rs-zoom-val');
|
const zoomVal = panel.querySelector('#rs-zoom-val');
|
||||||
zoomRange.addEventListener('input', () => {
|
|
||||||
readerSettings.pdfZoom = parseInt(zoomRange.value, 10);
|
function applyPdfZoom(newZoom) {
|
||||||
zoomVal.textContent = readerSettings.pdfZoom + '%';
|
const contentEl2 = $('reader-content');
|
||||||
|
// Preserve scroll position across zoom change
|
||||||
|
const fraction = contentEl2
|
||||||
|
? contentEl2.scrollTop / (contentEl2.scrollHeight - contentEl2.clientHeight || 1)
|
||||||
|
: 0;
|
||||||
|
readerSettings.pdfZoom = newZoom;
|
||||||
|
zoomRange.value = newZoom;
|
||||||
|
zoomVal.textContent = newZoom + '%';
|
||||||
saveReaderSettings();
|
saveReaderSettings();
|
||||||
if (readerSettings.pdfPaginated) {
|
if (readerSettings.pdfPaginated) {
|
||||||
pdfSmartZoomPage(pdfCurrentPage);
|
pdfSmartZoomPage(pdfCurrentPage);
|
||||||
} else {
|
} else {
|
||||||
const vp = document.getElementById('pdf-viewport');
|
const vp = document.getElementById('pdf-viewport');
|
||||||
if (vp) vp.style.zoom = readerSettings.pdfZoom / 100;
|
if (vp) vp.style.zoom = readerSettings.pdfZoom / 100;
|
||||||
}
|
if (contentEl2 && fraction > 0) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
contentEl2.scrollTop = fraction * (contentEl2.scrollHeight - contentEl2.clientHeight);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
zoomRange.addEventListener('input', () => applyPdfZoom(parseInt(zoomRange.value, 10)));
|
||||||
|
panel.querySelector('#rs-zoom-minus').addEventListener('click', () =>
|
||||||
|
applyPdfZoom(Math.max(50, readerSettings.pdfZoom - 10)));
|
||||||
|
panel.querySelector('#rs-zoom-plus').addEventListener('click', () =>
|
||||||
|
applyPdfZoom(Math.min(200, readerSettings.pdfZoom + 10)));
|
||||||
|
|
||||||
panel.querySelector('#rs-invert').addEventListener('click', function () {
|
panel.querySelector('#rs-invert').addEventListener('click', function () {
|
||||||
readerSettings.pdfInverted = !readerSettings.pdfInverted;
|
readerSettings.pdfInverted = !readerSettings.pdfInverted;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue