mirror of
https://codeberg.org/armin/noiz.git
synced 2026-09-01 14:00:54 +02:00
Fix zooming in Python webview (./noiz)
This commit is contained in:
parent
c64478bce9
commit
ffbb77e352
2 changed files with 14 additions and 4 deletions
13
index.html
13
index.html
|
|
@ -1410,11 +1410,24 @@ async function collectFiles(entry, files, paths, path, onFile) {
|
|||
}
|
||||
}
|
||||
|
||||
let zoomLevel = 1;
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.target.tagName === 'INPUT' || e.target.tagName === 'SELECT') return;
|
||||
if (e.code === 'Space') { e.preventDefault(); playBtn.click(); }
|
||||
if (e.code === 'ArrowRight') nextBtn.click();
|
||||
if (e.code === 'ArrowLeft') prevBtn.click();
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
if (e.key === '+' || e.code === 'NumpadAdd') {
|
||||
e.preventDefault(); zoomLevel = Math.min(3, +(zoomLevel + 0.1).toFixed(1));
|
||||
document.body.style.zoom = zoomLevel;
|
||||
} else if (e.key === '-' || e.code === 'NumpadSubtract') {
|
||||
e.preventDefault(); zoomLevel = Math.max(0.3, +(zoomLevel - 0.1).toFixed(1));
|
||||
document.body.style.zoom = zoomLevel;
|
||||
} else if ((e.key === '0' && !e.shiftKey) || e.code === 'Numpad0') {
|
||||
e.preventDefault(); zoomLevel = 1;
|
||||
document.body.style.zoom = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('focus', () => {
|
||||
|
|
|
|||
5
noiz
5
noiz
|
|
@ -1,8 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
import webview
|
||||
webview.create_window(
|
||||
"noiz://",
|
||||
"./index.html"
|
||||
)
|
||||
webview.create_window( "noiz://", "./index.html", zoomable=True)
|
||||
webview.start()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue