Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

M3: arrow keys follow the Scroll speed preference (#985) (#2333)

mtlcl410bfe61bebc534
diff --git a/ATTRIBUTION.toml b/ATTRIBUTION.toml
index e3b103ab3..072de00c9 100644
--- a/ATTRIBUTION.toml
+++ b/ATTRIBUTION.toml
@@ -7,7 +7,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Greek UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "dadc21af04311f400962fab2008e4cc1215097ee48bd15d8171ce8d5be1ed995"
+sha256 = "119708b98e105edcd2889739099ea3517d7bbee83c481f41f92274b32c005614"
# ATTRIBUTION.toml: one entry per asset (AGENTS.md §1). The source of truth for provenance and licences.
# ATTRIBUTION.md is generated from this file: `cargo xtask assets --write`. Checked by `cargo xtask assets` (part of `xtask ci`).
@@ -30,7 +30,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Simplified Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "49c2d8b5c765ad32839837ca0e2316adc81c7ad9bdce03004ddf3b8b1a2fb444"
+sha256 = "ae66a6f5a12265e3721dc72b9463f7508191e3a38bd2580079e26c9909adab54"
[[asset]]
path = "crates/ui-egui/src/i18n/zh-hant.tsv"
@@ -41,7 +41,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Traditional Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "1c41a76c4af3aa31477cd623fd33fc263c20b7a000d2c72f626d487460df4b97"
+sha256 = "003d784c749c1134d31ff287c107818e8676ee6317531d513580249c4f22f6a6"
[[asset]]
path = "crates/ui-egui/src/i18n/cs.tsv"
@@ -52,7 +52,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Czech UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "cc5ab5afd85cbf878c90efa227d078c8ec9de2984ff26d472c17c1708eb9f8f8"
+sha256 = "d864ced685fb6796af01ba286b8ef8987a763c811e18a6cdc6b056c7aeef90dc"
[[asset]]
path = "crates/ui-egui/src/i18n/pt-br.tsv"
@@ -63,7 +63,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Brazilian Portuguese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "697bc6101239a291fe8530ddf874c811c694f26e01df710dc7ee61b41773c948"
+sha256 = "fe2cb9a64b0a484015919a7dd792367157df813451ad6d0a94cd958f1e020855"
[[asset]]
path = "crates/ui-egui/src/i18n/es.tsv"
@@ -74,7 +74,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Spanish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "b3f75c272623a778bbc3819939fd4e09e399d687882b291d629d1f05064976fc"
+sha256 = "249bc15bf1dc579a6f90dcd895b0f6b50f44af4fc46ea99e5b00bfff08434269"
[[asset]]
path = "crates/ui-egui/src/i18n/fr.tsv"
@@ -85,7 +85,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "French UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "2f25c13e15f306a1adbec4978648015e25a4178936350a4123ff2a752fe03efc"
+sha256 = "d94c9effca419f721ab2c6c40018e5f0d6b51f744cc915c924b97442b17eb6e9"
[[asset]]
path = "crates/ui-egui/src/i18n/de.tsv"
@@ -96,7 +96,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "German UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "ca9c1ebeac08e194b20bc8d2b7836ed8dab50affdce905c47a4a76b9b5ad171f"
+sha256 = "63d36be7c0df64eeb7dc0ff62923d41fa7fa337fc5e442e67b1ee141a1c5e382"
[[asset]]
path = "crates/ui-egui/src/i18n/te.tsv"
@@ -107,7 +107,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Telugu UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "2d35261ae57f6c641630adb98254dc75e164ae759a18a6156b45db044a1c45ba"
+sha256 = "ec20cf580a10a1c8d6d5a70fd94a364cc4d2bacfc5230555967db272ccd9b22d"
[[asset]]
path = "crates/ui-egui/src/i18n/it.tsv"
@@ -118,7 +118,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Italian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "6fc0b69e7d7f63cbc2d672e162c7b61f807c6c182727def155397476e2351bbf"
+sha256 = "8c8486b06c8e77497ff1589c42566b9350c7a0a0f378c6762a65b80f34b81841"
[[asset]]
path = "crates/ui-egui/src/i18n/pl.tsv"
@@ -129,7 +129,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Polish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "413da7472d0558b555e48216ab5078a302580e998274e10007369ca46d6c8196"
+sha256 = "6aee8779c09c9b5b24a001d4a8f14d181a62a868db81920aa4614a15ca3f21ed"
[[asset]]
path = "crates/ui-egui/src/i18n/ru.tsv"
@@ -140,7 +140,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Russian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "aaa593ea03a42cfe44dcd8054b01207e788be8f29becbe37d10eed42f946714b"
+sha256 = "35ad5905515e25b7dd4b31320f58bf54481e2c6b868e3e0a3ad1090558675ce3"
[[asset]]
path = "crates/ui-egui/src/i18n/hu.tsv"
@@ -151,7 +151,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Hungarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "166c745d7e80af7d36baaddb6027284b7aff0b61e42bc55eaac0dc8982e7fb3c"
+sha256 = "369603fb7ff64bd576de6dad7077b41794f933bf2633fcd313674e2aa9dbf989"
[[asset]]
path = "crates/ui-egui/src/i18n/bg.tsv"
@@ -162,7 +162,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Bulgarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "47e9c4b1aa621cf05cc39fa2da1986a970f73377f2759dfc4128fdc5f0bdc4af"
+sha256 = "6031098e20e488163969e4f403105a095581fd71b53dd16f063ecb71f93aba00"
[[asset]]
path = "crates/ui-egui/src/i18n/kk.tsv"
@@ -173,7 +173,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Kazakh UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "2237b9e378863361254d7a267c1a6887fbe2e0638aba15d4956e2fbef35daf80"
+sha256 = "61d6bde7f2e3aac19449fe8b980d42d4b8a65536cac23ebae1553f81a1bb0372"
[[asset]]
path = "crates/ui-egui/src/i18n/ja.tsv"
@@ -184,7 +184,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Japanese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "38c3086beaad4a2b0e13cb26b97eaadc97a1f3871c9e59d3b411ec4bfe9686e5"
+sha256 = "12003f40f6ce0bda46c7ead8de8e9c054e4ea605ce93d7fe0833e9e99d293bf9"
[[asset]]
path = "crates/ui-egui/src/i18n/uk.tsv"
@@ -195,7 +195,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Ukrainian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "a6b7ce0fdd44827951b0873e319fa381919be6e05fa5f919965b8f8df658416a"
+sha256 = "f52e62e7bf4a2c78a21919bed90c81c9feb65feac1a615142f9f6d9f429fde54"
[[asset]]
path = "crates/ui-egui/src/i18n/ar.tsv"
@@ -206,7 +206,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Arabic UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "40613047ce409b34d97489ef422aedd392ff2251fb383a8d3d5c411f3560d6e4"
+sha256 = "5292e88884e380090d191597e254f1f135e1a569d4336432ae5bb2a0b5233d11"
[[asset]]
path = "crates/ui-egui/src/i18n/tr.tsv"
@@ -217,7 +217,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Turkish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "cae07bcc17be4f3ebd882bb987d5da53891fbcfdc76e41db05623119248ca762"
+sha256 = "138d6e18c5581205b61ca647eedca8ddc65f6eaed9ed8f6cad6e4fa788f31ddf"
[[asset]]
path = "crates/ui-egui/src/i18n/lt.tsv"
@@ -228,7 +228,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Lithuanian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "72a3d59cda8ce1d5c39a51a69f06dc2cd9f60698c448b1036e70e4e7d6c65e4b"
+sha256 = "fdc8591ecf8e4805c8bafef88810185676177a85bced0a47d4cc7c065e634267"
[[asset]]
@@ -3363,7 +3363,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Slovene UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "33629fdae4b1dd288c6cdc9c479810df61fe1dcb9470941289b8719c649df6ca"
+sha256 = "af96cf439b9ea1c7e1d9177f909a14d2c0513572b6a579a5350d272fb70c53b2"
[[asset]]
path = "vendor/vello_common/assets/probe.png"
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index d015040ce..e44c917d8 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -2048,7 +2048,7 @@ impl PageXform {
}
}
-pub fn shortcuts(view: &mut DocView, ctx: &egui::Context) {
+pub fn shortcuts(view: &mut DocView, ctx: &egui::Context, speed: crate::scroll_speed::ScrollSpeed) {
use egui::{Key, KeyboardShortcut, Modifiers};
if ctx.input_mut(|i| i.consume_shortcut(&KeyboardShortcut::new(Modifiers::COMMAND, Key::F))) {
view.open_find();
@@ -2138,9 +2138,12 @@ pub fn shortcuts(view: &mut DocView, ctx: &egui::Context) {
// ↓ / ↑ scroll a line, and Page Down / Page Up a screen where the pages scroll. In
// single-page view, ↓ / ↑ turn the page once there is nothing left to scroll that way, as
// the wheel does (#273): always on a page that fits.
+ // The Scroll speed preference sets how far ↓ / ↑ go as well as the wheel (#985); Page Down /
+ // Page Up keep a screen.
if !command {
+ let line = KEY_SCROLL_LINE * speed.factor();
let screen = (view.viewport_h - KEY_SCROLL_LINE).max(KEY_SCROLL_LINE);
- let steps = [(Key::ArrowDown, KEY_SCROLL_LINE), (Key::ArrowUp, -KEY_SCROLL_LINE), (Key::PageDown, screen), (Key::PageUp, -screen)];
+ let steps = [(Key::ArrowDown, line), (Key::ArrowUp, -line), (Key::PageDown, screen), (Key::PageUp, -screen)];
for (k, by) in steps {
let arrow = matches!(k, Key::ArrowDown | Key::ArrowUp);
if !key(k) || !(scrolls || arrow) {
@@ -2166,8 +2169,8 @@ pub fn shortcuts(view: &mut DocView, ctx: &egui::Context) {
}
}
-/// How far ↓ / ↑ scroll: a mouse-wheel line on the desktop. Page Down / Page Up keep this much
-/// of the previous screen in view.
+/// How far ↓ / ↑ scroll at Normal speed (Scroll speed halves or doubles it). Page Down / Page Up
+/// keep this much of the previous screen in view.
const KEY_SCROLL_LINE: f32 = 40.0;
pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) {
diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv
index 6bf8e8cd9..4326a5cf6 100644
--- a/crates/ui-egui/src/i18n/ar.tsv
+++ b/crates/ui-egui/src/i18n/ar.tsv
@@ -2301,7 +2301,7 @@ key Space مسافة
Rotate page {label} counterclockwise تدوير الصفحة {label} عكس اتجاه عقارب الساعة
Rotate page {label} clockwise تدوير الصفحة {label} باتجاه عقارب الساعة
Delete page {label} حذف الصفحة {label}
- Mouse wheel scroll speed سرعة التمرير بعجلة الماوس
+ Scroll speed (mouse wheel and arrow keys) سرعة التمرير (عجلة الفأرة ومفاتيح الأسهم)
scroll speed Slow بطيئة
scroll speed Normal عادية
scroll speed Fast سريعة
diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv
index 7be35cbac..dd021c56a 100644
--- a/crates/ui-egui/src/i18n/bg.tsv
+++ b/crates/ui-egui/src/i18n/bg.tsv
@@ -2243,7 +2243,7 @@ key Space Интервал
Rotate page {label} counterclockwise Завъртане на страница {label} обратно на часовниковата стрелка
Rotate page {label} clockwise Завъртане на страница {label} по часовниковата стрелка
Delete page {label} Изтриване на страница {label}
- Mouse wheel scroll speed Скорост на превъртане с колелцето на мишката
+ Scroll speed (mouse wheel and arrow keys) Скорост на превъртане (колелце на мишката и клавиши със стрелки)
scroll speed Slow Ниска
scroll speed Normal Нормална
scroll speed Fast Висока
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index b17621ae5..ae2c19022 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -2331,7 +2331,7 @@ certificate Subject Subjekt
Active Aktivní
Dark theme Tmavý motiv
Appearance settings… Nastavení vzhledu…
- Mouse wheel scroll speed Rychlost posouvání kolečkem myši
+ Scroll speed (mouse wheel and arrow keys) Rychlost posouvání (kolečko myši a šipky)
scroll speed Slow Pomalá
scroll speed Normal Normální
scroll speed Fast Rychlá
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 57b6587ca..d1024fa64 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -2281,7 +2281,7 @@ key Space Leertaste
This file changed on disk. Reload shows the new version and drops your unsaved changes; Save replaces it with this version. Diese Datei wurde auf dem Datenträger geändert. „Neu laden“ zeigt die neue Version und verwirft Ihre ungespeicherten Änderungen; „Speichern“ ersetzt sie durch diese Version.
Reload Neu laden
Couldn't reload {name}: {e} {name} konnte nicht neu geladen werden: {e}
- Mouse wheel scroll speed Scrollgeschwindigkeit des Mausrads
+ Scroll speed (mouse wheel and arrow keys) Bildlaufgeschwindigkeit (Mausrad und Pfeiltasten)
scroll speed Slow Langsam
scroll speed Normal Normal
scroll speed Fast Schnell
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 2196afd8d..07400e483 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -2285,7 +2285,7 @@ comment menu Edit Επεξεργασία
This file changed on disk. Reload shows the new version and drops your unsaved changes; Save replaces it with this version. Αυτό το αρχείο άλλαξε στον δίσκο. Η επαναφόρτωση δείχνει τη νέα έκδοση και απορρίπτει τις μη αποθηκευμένες αλλαγές σας· η αποθήκευση την αντικαθιστά με αυτή την έκδοση.
Reload Επαναφόρτωση
Couldn't reload {name}: {e} Δεν ήταν δυνατή η επαναφόρτωση του {name}: {e}
- Mouse wheel scroll speed Ταχύτητα κύλισης τροχού ποντικιού
+ Scroll speed (mouse wheel and arrow keys) Ταχύτητα κύλισης (τροχός ποντικιού και πλήκτρα βέλους)
scroll speed Slow Αργή
scroll speed Normal Κανονική
scroll speed Fast Γρήγορη
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index d113b53e3..70a06e1f8 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2417,7 +2417,7 @@ key Space Espacio
Rotate page {label} counterclockwise Girar la página {label} a la izquierda
Rotate page {label} clockwise Girar la página {label} a la derecha
Delete page {label} Eliminar la página {label}
- Mouse wheel scroll speed Velocidad de desplazamiento de la rueda del ratón
+ Scroll speed (mouse wheel and arrow keys) Velocidad de desplazamiento (rueda del ratón y teclas de flecha)
scroll speed Slow Lenta
scroll speed Normal Normal
scroll speed Fast Rápida
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 7db8f4ef0..322da37ff 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -2280,7 +2280,7 @@ key Space Espace
Rotate page {label} counterclockwise Faire pivoter la page {label} dans le sens antihoraire
Rotate page {label} clockwise Faire pivoter la page {label} dans le sens horaire
Delete page {label} Supprimer la page {label}
- Mouse wheel scroll speed Vitesse de défilement de la molette
+ Scroll speed (mouse wheel and arrow keys) Vitesse de défilement (molette et touches fléchées)
scroll speed Slow Lente
scroll speed Normal Normale
scroll speed Fast Rapide
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 5484d4e1d..d16a9f788 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -2279,7 +2279,7 @@ key Space Szóköz
Rotate page {label} counterclockwise {label}. oldal elforgatása az óramutató járásával ellentétesen
Rotate page {label} clockwise {label}. oldal elforgatása az óramutató járásával megegyezően
Delete page {label} {label}. oldal törlése
- Mouse wheel scroll speed Egérgörgő görgetési sebessége
+ Scroll speed (mouse wheel and arrow keys) Görgetési sebesség (egérgörgő és nyílbillentyűk)
scroll speed Slow Lassú
scroll speed Normal Normál
scroll speed Fast Gyors
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index db3a27ad4..88bd62077 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -2289,7 +2289,7 @@ key Space Spazio
Rotate page {label} counterclockwise Ruota pagina {label} in senso antiorario
Rotate page {label} clockwise Ruota pagina {label} in senso orario
Delete page {label} Elimina pagina {label}
- Mouse wheel scroll speed Velocità di scorrimento della rotellina del mouse
+ Scroll speed (mouse wheel and arrow keys) Velocità di scorrimento (rotellina del mouse e tasti freccia)
scroll speed Slow Lenta
scroll speed Normal Normale
scroll speed Fast Veloce
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 22245049c..4c8500940 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -2280,7 +2280,7 @@ key Space スペース
Rotate page {label} counterclockwise ページ {label} を反時計回りに回転
Rotate page {label} clockwise ページ {label} を時計回りに回転
Delete page {label} ページ {label} を削除
- Mouse wheel scroll speed マウスホイールのスクロール速度
+ Scroll speed (mouse wheel and arrow keys) スクロール速度(マウスホイールと矢印キー)
scroll speed Slow 遅い
scroll speed Normal 標準
scroll speed Fast 速い
diff --git a/crates/ui-egui/src/i18n/kk.tsv b/crates/ui-egui/src/i18n/kk.tsv
index e98565c44..5a5d85c54 100644
--- a/crates/ui-egui/src/i18n/kk.tsv
+++ b/crates/ui-egui/src/i18n/kk.tsv
@@ -2275,7 +2275,7 @@ key Space Бос орын
This file changed on disk. Reload shows the new version and drops your unsaved changes; Save replaces it with this version. Бұл файл дискіде өзгертілді. «Қайта жүктеу» жаңа нұсқаны көрсетіп, сақталмаған өзгерістеріңізді тастайды; «Сақтау» оны осы нұсқамен алмастырады.
Reload Қайта жүктеу
Couldn't reload {name}: {e} {name} қайта жүктеу мүмкін болмады: {e}
- Mouse wheel scroll speed Тінтуір дөңгелегімен айналдыру жылдамдығы
+ Scroll speed (mouse wheel and arrow keys) Айналдыру жылдамдығы (тінтуір дөңгелегі және көрсеткі пернелері)
scroll speed Slow Баяу
scroll speed Normal Қалыпты
scroll speed Fast Жылдам
diff --git a/crates/ui-egui/src/i18n/lt.tsv b/crates/ui-egui/src/i18n/lt.tsv
index df8b870e6..887de283a 100644
--- a/crates/ui-egui/src/i18n/lt.tsv
+++ b/crates/ui-egui/src/i18n/lt.tsv
@@ -724,7 +724,7 @@
More options Daugiau parinkčių
More options: Daugiau parinkčių:
More ways to add files Daugiau būdų pridėti failų
- Mouse wheel scroll speed Slinkimo ratuku greitis
+ Scroll speed (mouse wheel and arrow keys) Slinkimo greitis (pelės ratukas ir rodyklių klavišai)
Move down Perkelti žemyn
Move earlier Perkelti anksčiau
Move later Perkelti vėliau
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index fe2fa1b4c..ab017e7f2 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -2260,7 +2260,7 @@ key Space Spacja
Rotate page {label} counterclockwise Obróć stronę {label} w lewo
Rotate page {label} clockwise Obróć stronę {label} w prawo
Delete page {label} Usuń stronę {label}
- Mouse wheel scroll speed Szybkość przewijania kółkiem myszy
+ Scroll speed (mouse wheel and arrow keys) Szybkość przewijania (kółko myszy i klawisze strzałek)
scroll speed Slow Wolna
scroll speed Normal Normalna
scroll speed Fast Szybka
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 380c6d063..15bc496af 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -2294,7 +2294,7 @@ calendar date September setembro
calendar date October outubro
calendar date November novembro
calendar date December dezembro
- Mouse wheel scroll speed Velocidade de rolagem da roda do mouse
+ Scroll speed (mouse wheel and arrow keys) Velocidade de rolagem (roda do mouse e teclas de seta)
scroll speed Slow Lenta
scroll speed Normal Normal
scroll speed Fast Rápida
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 3b23a4277..dcce4bf0c 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2193,7 +2193,7 @@ key Space Пробел
Rotate page {label} counterclockwise Повернуть страницу {label} против часовой стрелки
Rotate page {label} clockwise Повернуть страницу {label} по часовой стрелке
Delete page {label} Удалить страницу {label}
- Mouse wheel scroll speed Скорость прокрутки колесом мыши
+ Scroll speed (mouse wheel and arrow keys) Скорость прокрутки (колесо мыши и клавиши со стрелками)
scroll speed Slow Низкая
scroll speed Normal Обычная
scroll speed Fast Высокая
diff --git a/crates/ui-egui/src/i18n/sl.tsv b/crates/ui-egui/src/i18n/sl.tsv
index 01e9eadc0..62708bbf6 100644
--- a/crates/ui-egui/src/i18n/sl.tsv
+++ b/crates/ui-egui/src/i18n/sl.tsv
@@ -2282,7 +2282,7 @@ key Space Preslednica
This file changed on disk. Reload shows the new version and drops your unsaved changes; Save replaces it with this version. Ta datoteka se je na disku spremenila. Ponovno naloži pokaže novo različico in zavrže neshranjene spremembe; Shrani jo zamenja s to različico.
Reload Znova naloži
Couldn't reload {name}: {e} Datoteke {name} ni bilo mogoče znova naložiti: {e}
- Mouse wheel scroll speed Hitrost drsenja s kolescem miške
+ Scroll speed (mouse wheel and arrow keys) Hitrost drsenja (kolesce miške in puščične tipke)
scroll speed Slow Počasi
scroll speed Normal Običajno
scroll speed Fast Hitro
diff --git a/crates/ui-egui/src/i18n/te.tsv b/crates/ui-egui/src/i18n/te.tsv
index 29c7b7c87..e913e3fd1 100644
--- a/crates/ui-egui/src/i18n/te.tsv
+++ b/crates/ui-egui/src/i18n/te.tsv
@@ -2194,7 +2194,7 @@ key Space స్పేస్
Rotate page {label} counterclockwise {label} పేజీని అపసవ్య దిశలో తిప్పండి
Rotate page {label} clockwise {label} పేజీని సవ్య దిశలో తిప్పండి
Delete page {label} {label} పేజీని తొలగించండి
- Mouse wheel scroll speed మౌస్ వీల్ స్క్రోల్ వేగం
+ Scroll speed (mouse wheel and arrow keys) స్క్రోల్ వేగం (మౌస్ వీల్ మరియు బాణం కీలు)
scroll speed Slow నెమ్మదిగా
scroll speed Normal సాధారణం
scroll speed Fast వేగంగా
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index ac3f443e9..aee579923 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -2273,7 +2273,7 @@ key Space Boşluk
This file changed on disk. Reload shows the new version and drops your unsaved changes; Save replaces it with this version. Bu dosya diskte değişti. Yeniden yükle yeni sürümü gösterir ve kaydedilmemiş değişikliklerinizi atar; Kaydet onu bu sürümle değiştirir.
Reload Yeniden yükle
Couldn't reload {name}: {e} {name} yeniden yüklenemedi: {e}
- Mouse wheel scroll speed Fare tekerleği kaydırma hızı
+ Scroll speed (mouse wheel and arrow keys) Kaydırma hızı (fare tekerleği ve ok tuşları)
scroll speed Slow Yavaş
scroll speed Normal Orta
scroll speed Fast Hızlı
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index d2078ad5e..6db566dbc 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -2302,7 +2302,7 @@ key Space Пробіл
Rotate page {label} counterclockwise Повернути сторінку {label} проти годинникової стрілки
Rotate page {label} clockwise Повернути сторінку {label} за годинниковою стрілкою
Delete page {label} Видалити сторінку {label}
- Mouse wheel scroll speed Швидкість прокручування коліщатком миші
+ Scroll speed (mouse wheel and arrow keys) Швидкість прокручування (коліщатко миші та клавіші зі стрілками)
scroll speed Slow Повільна
scroll speed Normal Звичайна
scroll speed Fast Швидка
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index a81a5e43d..da7c2d47a 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2244,7 +2244,7 @@ key Space 空格
Rotate page {label} counterclockwise 逆时针旋转页面 {label}
Rotate page {label} clockwise 顺时针旋转页面 {label}
Delete page {label} 删除页面 {label}
- Mouse wheel scroll speed 鼠标滚轮滚动速度
+ Scroll speed (mouse wheel and arrow keys) 滚动速度(鼠标滚轮和方向键)
scroll speed Slow 慢
scroll speed Normal 正常
scroll speed Fast 快
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 8ddfbeae9..e098a8cf1 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2156,7 +2156,7 @@ key Space 空格
Rotate page {label} counterclockwise 逆時針旋轉頁面 {label}
Rotate page {label} clockwise 順時針旋轉頁面 {label}
Delete page {label} 刪除頁面 {label}
- Mouse wheel scroll speed 滑鼠滾輪捲動速度
+ Scroll speed (mouse wheel and arrow keys) 捲動速度(滑鼠滾輪與方向鍵)
scroll speed Slow 慢
scroll speed Normal 正常
scroll speed Fast 快
diff --git a/crates/ui-egui/src/js_ui.rs b/crates/ui-egui/src/js_ui.rs
index fe474622c..c2ec784ef 100644
--- a/crates/ui-egui/src/js_ui.rs
+++ b/crates/ui-egui/src/js_ui.rs
@@ -382,7 +382,7 @@ pub(crate) fn preferences_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tok
#[cfg(not(target_arch = "wasm32"))]
ui.add(widgets::checkbox(&mut app.reload_changed_files, tl!("Reload documents when their files change on disk")));
ui.horizontal(|ui| {
- ui.label(tl!("Mouse wheel scroll speed"));
+ ui.label(tl!("Scroll speed (mouse wheel and arrow keys)"));
for speed in crate::scroll_speed::ScrollSpeed::ALL {
widgets::radio_value(ui, &mut app.scroll_speed, speed, tl_ctx!("scroll speed", speed.label()));
}
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index de3f22599..15d60ef4b 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -2801,7 +2801,7 @@ impl PdfCraftApp {
{
object_ui::nudge_keys(ctx, &mut self.views[i], doc);
}
- canvas::shortcuts(&mut self.views[i], ctx);
+ canvas::shortcuts(&mut self.views[i], ctx, self.scroll_speed);
self.copy_key(i, ctx);
self.image_pick_keys(i, ctx);
}
diff --git a/crates/ui-egui/src/scroll_speed.rs b/crates/ui-egui/src/scroll_speed.rs
index af8d0fe33..a2d857c74 100644
--- a/crates/ui-egui/src/scroll_speed.rs
+++ b/crates/ui-egui/src/scroll_speed.rs
@@ -1,4 +1,4 @@
-//! How far a mouse-wheel notch scrolls (#444, #186).
+//! How far a mouse-wheel notch scrolls (#444, #186), and ↓ / ↑ with it (#985).
//!
//! egui scrolls `line_scroll_speed` points per wheel line: 40 on the desktop, 8 on the web.
//! macOS already accelerates line deltas, and browsers there scroll about that far per line,
@@ -41,14 +41,18 @@ impl ScrollSpeed {
}
}
+ /// This speed relative to Normal.
+ pub fn factor(self) -> f32 {
+ match self {
+ Self::Slow => 0.5,
+ Self::Normal => 1.0,
+ Self::Fast => 2.0,
+ }
+ }
+
/// Points one wheel line scrolls.
pub fn line_points(self) -> f32 {
- NORMAL_LINE_POINTS
- * match self {
- Self::Slow => 0.5,
- Self::Normal => 1.0,
- Self::Fast => 2.0,
- }
+ NORMAL_LINE_POINTS * self.factor()
}
/// Makes egui scroll this far per wheel line, from this frame's input on (call it before egui
diff --git a/crates/ui-egui/tests/viewer.rs b/crates/ui-egui/tests/viewer.rs
index 114448923..90e1b524b 100644
--- a/crates/ui-egui/tests/viewer.rs
+++ b/crates/ui-egui/tests/viewer.rs
@@ -1621,3 +1621,26 @@ fn page_command_without_selection_acts_on_the_page_pressed() {
let d = s.session.get(s.views[s.active.unwrap()].id).unwrap();
assert_eq!(d.info.pages.iter().map(|p| p.rotation).collect::<Vec<_>>(), [90, 0]);
}
+
+/// ↓ / ↑ follow the Scroll speed preference as the wheel does (#985): Fast reaches the next page
+/// in about half the presses of Normal, and Slow takes about twice as many.
+#[test]
+fn arrow_keys_follow_the_scroll_speed_preference() {
+ use egui::Key;
+ let lines_to_page_2 = |speed: &str| {
+ let mut h = harness();
+ h.state_mut().active = Some(0);
+ h.state_mut().set_option("scroll_speed", speed).unwrap();
+ h.run_steps(4);
+ let mut n = 0;
+ while h.state().views[0].current == 0 {
+ h.key_press(Key::ArrowDown);
+ h.run_steps(2);
+ n += 1;
+ assert!(n < 1000, "↓ never reached page 2 at {speed}");
+ }
+ n
+ };
+ let (slow, normal, fast) = (lines_to_page_2("slow"), lines_to_page_2("normal"), lines_to_page_2("fast"));
+ assert!(fast * 3 < normal * 2 && normal * 3 < slow * 2, "presses to page 2: slow {slow}, normal {normal}, fast {fast}");
+}