Skip to content

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

feat(ui): preference to hide author-only highlight hover previews (#1432) (#1466)

Luis Araya24f93e61027e
diff --git a/ATTRIBUTION.toml b/ATTRIBUTION.toml
index fafd03248..5f1e2451c 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 = "7d1ae0d63cff95e85eea863831791c0a967a908e4062ab220ff2f3b0b77aee96"
+sha256 = "3476a5c81ffadc4583688aa6d3bc4456b2b13a16d8daf8cd2b650e764d89ff9d"
# 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 = "3d558b2d0ed089b1f554d9aa8d66c56a5e91f8f3ceb33031dc68bc8d511d4eb6"
+sha256 = "c5651b392263a30db0cd6c086e132edcc3ac4fab9a64fd786161bd5917c8d7bb"
[[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 = "4857aa037856ff8e2ba82dea4b630f42c611d6817c9677bf2c6a8133c57927f8"
+sha256 = "de71e41c22a8154ea46da3ecab69f5b972c8c8f81fa4393e12e449ab598e000f"
[[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 = "074d09497b6407d978f3ffd05cac81d52d1ddfe6c4ce8b0f564a00a203ec4579"
+sha256 = "cbfa1b7938f52b6d39cec95612bea3bbff5822e2d62f2e1e9871b92bab7efd34"
[[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 = "69c2fb412e7b5a7ef5ab9740ba9b29ba4e9509668623c7eef298d8cc06ad1068"
+sha256 = "018fd6acbab584c8fa1b49d5950e03e4209f9d073ea83d23bd57c5a114ef35d7"
[[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 = "9b32ef11741bca8b79d51daacfda0690ea0ec829bb2691d9b60543ccff2ccede"
+sha256 = "fa5e2462162d403c2c2d341a8d8534945724215dd21f6585ff79797dbdefb47a"
[[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 = "b6a451c484551d270b5efc42d91984d16fcc5d7c09930cc5a5339d430a7b96f9"
+sha256 = "d5a3a04bf5cd9ddb2e67d5e4c938508c3f6536806f8a476445c5fea90d275e4c"
[[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 = "28521cc75735a14a7b44f02d67a46ae54821f9f19e8d352513213ffcf529d7ee"
+sha256 = "1a30e7994b3dfbcca19a6a8a3c7fde8593b4bf7bb546bd2b266b274f3a224c2e"
[[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 = "db0205e928f498b0674fb84c604b45c7c83d23f170ee98c8d8a807c56422eb3d"
+sha256 = "3bd44d5996cebc76481d9dd2ded478bbbe2cf5fd24892ad8702a2ed059cbbfa9"
[[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 = "817fce18112db6084a03405d58ae110ed90d7fddc014b6c0af10a5e79ef4d906"
+sha256 = "0dd303b34e6ccbbed8c030e876a696bf555b8d33abac55ca02e415a5a987f067"
[[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 = "e9b507a72ac306bac9c3b6f4bb3917064b811fe60eb0041cda0b26349d469e95"
+sha256 = "7d59c4324d82ad3be522ce6cff16e5101334b6d816e8d920c529ba2151aa4233"
[[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 = "c400f2e8bd7cd0a49ac31c2c4fd4a2fab1a50a539e0a68ebba4cc028427e0fbb"
+sha256 = "7f1b964b5ac341c3d6e8b3328a319a2c9d7e6ca358255a155fb3499cb9bb9ee8"
[[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 = "c76086602063239d59fd8e54b2ea282dae1b22f7118437e4358ce3c35cc8f435"
+sha256 = "c1404eee8a87dde7d0900eb61f945518281e17edae26cc5615dc64e7f3335ee9"
[[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 = "3222d3448ac0d8020dfe5d8a0b3c5e3b6d93a26c54105f996de056569bfa64f4"
+sha256 = "433e5246288f0d27ed10463fe1c33461493a32f2f793684b001546678ade2195"
[[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 = "48480d411ecd9923a1c5ceae5ca8925a5a2eb660cdacd08df77054ce3a014db8"
+sha256 = "70cd926ae324621d24b6c75519ccab8dfa88f7b6a64a5d52bcf8b115d3ad8e27"
[[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 = "3e09f5942b85f677b0cf8b3b326a2ca1896eae205c1c86c283891148f1b2dca4"
+sha256 = "fc29daaff6f6377ab0a9e76a64995a0210f894251872d0d9a9a59e721bf542e1"
[[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 = "d28704a4803f764ffa52f308332636c9846832c4cf3a22093b9c1253afe512e6"
+sha256 = "cfa46745d42d4d4e14f6b3d941d83006129ae331e47a87a3ef673087ad7cb292"
[[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 = "a5f8e4e269f3ee2f466ed8bf2e2bb629fd0e79f149f0a536d7f64c26919b07b4"
+sha256 = "7ee8a57e49498a4a062d04d995a1129034c8e006defaf927460cf5dcf3c19e0e"
[[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 = "7be55c126ff56daf887ef1faf5bce8e0630dcc791adf5a57d772f28a3060aca7"
+sha256 = "398c94f07f44ba96f803e3ac64faf606562c5c9a5dc02765c1ed10a648c7251e"
[[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 = "137d522b0b8746519a8d2cfaad3908d4fa3e4fd80eb6a1233a4c693d4492e7aa"
+sha256 = "7affbbad51af9b4fd54aec7fb118500a81f145eea79070a61e645f989449560b"
[[asset]]
@@ -240,7 +240,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Vietnamese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "5a14dc07d02b4b5ca6c5e06cfe80f459d195791bf42f0f2a75a73fc8292f57b1"
+sha256 = "1ea1b1ebc84ad7f84efafd6777469259709dc9f4c9ed93147f2522433d42ff5c"
[[asset]]
path = "assets/icons/accessibility.svg"
@@ -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 = "ddaec4954dd6b46e089ae31da9c012d10a03da33ee138b07793e869f3813d5c3"
+sha256 = "7a4558dc2e1fdbfc254b823839db49d05c6113fdf3414d250895b3063d916bba"
[[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 22a96274c..1d0f71c01 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -3222,8 +3222,10 @@ pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) {
let gesturing = view.comments.gesture.is_some() || freehand;
for a in info.annotations.iter().filter(|a| a.page == i && !gesturing) {
let sr = xf.user_rect(info, i, a.rect);
+ let hidden = prefs.hide_empty_highlight_hover && a.subtype == "Highlight" && a.contents.as_deref().is_none_or(str::is_empty);
if sr.contains(p)
&& hover_text.is_none()
+ && !hidden
&& let Some(text) = annotation_hover_text(a)
{
hover_text = Some((p, text));
diff --git a/crates/ui-egui/src/comments.rs b/crates/ui-egui/src/comments.rs
index 37adb1ea0..3bdbf5a2c 100644
--- a/crates/ui-egui/src/comments.rs
+++ b/crates/ui-egui/src/comments.rs
@@ -250,6 +250,8 @@ pub struct CommentPrefs {
pub pinned: bool,
/// The tool each flyout group shows (the last one used).
pub group_tool: [CommentTool; 3],
+ /// Hide hover previews on highlight annotations when they contain no comment text beyond the author.
+ pub hide_empty_highlight_hover: bool,
}
impl Default for CommentPrefs {
@@ -259,6 +261,7 @@ impl Default for CommentPrefs {
styles: ALL.iter().map(|t| (*t, Style::default_for(&t.sample()))).collect(),
pinned: false,
group_tool: [CommentTool::Note, CommentTool::Highlight, CommentTool::Ink],
+ hide_empty_highlight_hover: false,
}
}
}
diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv
index ccb7bda43..7c2cfab00 100644
--- a/crates/ui-egui/src/i18n/ar.tsv
+++ b/crates/ui-egui/src/i18n/ar.tsv
@@ -34,6 +34,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. يتبع الوضع التلقائي حجم النص في النظام. تُعرض الصفحات دائمًا بالدقة الكاملة للشاشة.
Identity الهوية
Name on new comments الاسم على التعليقات الجديدة
+ Hide hover previews for highlights without comment text إخفاء معاينات التمرير للتظليلات التي لا تحتوي على نص تعليق
Open… فتح…
Open Recent فتح الملفات الأخيرة
Pin folder to Home… تثبيت مجلد في الصفحة الرئيسية…
diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv
index 2c2c67d3f..6fc9ddb7d 100644
--- a/crates/ui-egui/src/i18n/bg.tsv
+++ b/crates/ui-egui/src/i18n/bg.tsv
@@ -60,6 +60,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Автоматично следва размера на текста в системата. Страниците винаги се изобразяват с пълната разделителна способност на екрана.
Identity Самоличност
Name on new comments Име в новите коментари
+ Hide hover previews for highlights without comment text Скриване на прегледите при посочване за маркирания без текст на коментар
Open… Отвори…
Open Recent Последно отваряни
Pin folder to Home… Закачи папка в Начало…
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 36aed74ab..1571b5ab8 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -40,6 +40,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Automaticky se řídí velikostí textu v systému. Stránky se vždy vykreslují v plném rozlišení displeje.
Identity Identita
Name on new comments Jméno autora nových komentářů
+ Hide hover previews for highlights without comment text Skrýt náhledy při najetí u zvýraznění bez textu komentáře
Enable Acrobat JavaScript Povolit Acrobat JavaScript
OK OK
Open… Otevřít…
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 748e514b1..9d6ad17e5 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -23,6 +23,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Automatisch folgt der Textgröße des Systems. Seiten werden immer in der vollen Auflösung des Bildschirms dargestellt.
Identity Identität
Name on new comments Name für neue Kommentare
+ Hide hover previews for highlights without comment text Hover-Vorschau für Hervorhebungen ohne Kommentartext ausblenden
Open… Öffnen…
New blank PDF Neues leeres PDF
Create PDF from file… PDF aus Datei erstellen…
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index ff654f311..7b6a32fe8 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -16,6 +16,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Η αυτόματη ρύθμιση ακολουθεί το μέγεθος κειμένου του συστήματος. Οι σελίδες αποδίδονται πάντα στην πλήρη ανάλυση της οθόνης.
Identity Ταυτότητα
Name on new comments Όνομα στα νέα σχόλια
+ Hide hover previews for highlights without comment text Απόκρυψη προεπισκοπήσεων κατά την αιώρηση για επισημάνσεις χωρίς κείμενο σχολίου
Open… Άνοιγμα…
Open Recent Άνοιγμα πρόσφατων
Clear Recent Files Εκκαθάριση πρόσφατων αρχείων
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 602dd2316..dc36934c0 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -23,6 +23,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Automático sigue el tamaño del texto del sistema. Las páginas siempre se muestran con la resolución completa de la pantalla.
Identity Identidad
Name on new comments Nombre en los comentarios nuevos
+ Hide hover previews for highlights without comment text Ocultar las vistas previas al pasar el puntero en resaltados sin texto de comentario
Open… Abrir…
Open Recent Abrir recientes
Clear Recent Files Borrar archivos recientes
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index bbead473b..437654d08 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -23,6 +23,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Automatique suit la taille du texte du système. Les pages sont toujours rendues à la pleine résolution de l'écran.
Identity Identité
Name on new comments Nom sur les nouveaux commentaires
+ Hide hover previews for highlights without comment text Masquer les aperçus au survol des surlignages sans texte de commentaire
Open… Ouvrir…
New blank PDF Nouveau PDF vierge
Create PDF from file… Créer un PDF à partir d'un fichier…
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 5ac50c8e7..c058424eb 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -23,6 +23,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Az Automatikus beállítás a rendszer szövegméretét követi. Az oldalak mindig a kijelző teljes felbontásában jelennek meg.
Identity Személyazonosság
Name on new comments Név az új megjegyzéseken
+ Hide hover previews for highlights without comment text Megjegyzésszöveg nélküli kiemelések előnézetének elrejtése rámutatáskor
Open… Megnyitás…
New blank PDF Új üres PDF
Create PDF from file… PDF létrehozása fájlból…
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 513759743..4f750fd56 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -29,6 +29,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Auto segue la dimensione del testo del sistema. Le pagine vengono sempre visualizzate alla piena risoluzione dello schermo.
Identity Identità
Name on new comments Nome sui nuovi commenti
+ Hide hover previews for highlights without comment text Nascondi le anteprime al passaggio del puntatore per le evidenziazioni senza testo di commento
Open… Apri…
Open Recent Apri recenti
Pin folder to Home… Fissa una cartella sulla Home…
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 2392d4b25..36b586f1a 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -29,6 +29,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. 自動にすると、システムの文字サイズに合わせます。ページは常にディスプレイの最大解像度で描画されます。
Identity 個人情報
Name on new comments 新しい注釈の作成者名
+ Hide hover previews for highlights without comment text コメントテキストのないハイライトのホバープレビューを非表示にする
Open… 開く…
Open Recent 最近のファイルを開く
Clear Recent Files 最近のファイルをクリア
diff --git a/crates/ui-egui/src/i18n/kk.tsv b/crates/ui-egui/src/i18n/kk.tsv
index 2a0fc7461..514dab8cf 100644
--- a/crates/ui-egui/src/i18n/kk.tsv
+++ b/crates/ui-egui/src/i18n/kk.tsv
@@ -9,6 +9,7 @@
Interface language Интерфейс тілі
Identity Жеке деректер
Name on new comments Жаңа түсініктемелердегі аты
+ Hide hover previews for highlights without comment text Түсініктеме мәтіні жоқ белгілеулер үшін меңзер алдын ала қарауын жасыру
Open… Ашу…
Open Recent Соңғы файлдарды ашу
Pin folder to Home… Қалтаны Басты бетке бекіту…
diff --git a/crates/ui-egui/src/i18n/lt.tsv b/crates/ui-egui/src/i18n/lt.tsv
index 29d6b9ed5..b5068417f 100644
--- a/crates/ui-egui/src/i18n/lt.tsv
+++ b/crates/ui-egui/src/i18n/lt.tsv
@@ -22,6 +22,7 @@
Auto ({percent}%) Automatiškai ({percent} %)
Identity Tapatybė
Name on new comments Naujų komentarų autoriaus vardas
+ Hide hover previews for highlights without comment text Slėpti užvedimo peržiūras paryškinimams be komentaro teksto
Open… Atverti…
Open Recent Atverti paskiausiai naudotus failus
Clear Recent Files Išvalyti paskiausiai naudotų failų sąrašą
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 0010dffa2..ce9f9bb3c 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -26,6 +26,7 @@
Interface language Język interfejsu
Identity Tożsamość
Name on new comments Autor nowych komentarzy
+ Hide hover previews for highlights without comment text Ukryj podglądy po najechaniu dla wyróżnień bez tekstu komentarza
Open… Otwórz…
Open Recent Otwórz ostatnie
Clear Recent Files Wyczyść listę ostatnich plików
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 8f7695a04..ee967c5f5 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -23,6 +23,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Automático segue o tamanho do texto do sistema. As páginas sempre são exibidas na resolução total da tela.
Identity Identidade
Name on new comments Nome nos novos comentários
+ Hide hover previews for highlights without comment text Ocultar as prévias ao passar o ponteiro em destaques sem texto de comentário
Open… Abrir…
Open Recent Abrir recentes
Clear Recent Files Limpar arquivos recentes
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 8d14595be..6d1b5639a 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -22,6 +22,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. В режиме «Авто» используется размер текста из настроек системы. Страницы всегда отображаются в полном разрешении экрана.
Identity Идентификация
Name on new comments Имя в новых комментариях
+ Hide hover previews for highlights without comment text Скрывать всплывающий просмотр для выделений без текста комментария
Open… Открыть…
Open Recent Открыть недавние
Clear Recent Files Очистить недавние файлы
diff --git a/crates/ui-egui/src/i18n/sl.tsv b/crates/ui-egui/src/i18n/sl.tsv
index 6c33abc66..61e2637a7 100644
--- a/crates/ui-egui/src/i18n/sl.tsv
+++ b/crates/ui-egui/src/i18n/sl.tsv
@@ -1121,6 +1121,7 @@
Name Ime
Name (A–Z) Ime (A–Ž)
Name on new comments Ime na novih komentarjih
+ Hide hover previews for highlights without comment text Skrij predoglede ob lebdenju za označitve brez besedila komentarja
Name: Ime:
Named Destinations Poimenovani cilji
Navigation links Navigacijske povezave
diff --git a/crates/ui-egui/src/i18n/te.tsv b/crates/ui-egui/src/i18n/te.tsv
index 9431eb122..c1f075eed 100644
--- a/crates/ui-egui/src/i18n/te.tsv
+++ b/crates/ui-egui/src/i18n/te.tsv
@@ -27,6 +27,7 @@ comment menu Edit సవరించు
Auto follows the system's text size. Pages always render at the display's full resolution. ఆటో సిస్టమ్ టెక్స్ట్ పరిమాణాన్ని అనుసరిస్తుంది. పేజీలు ఎల్లప్పుడూ డిస్‌ప్లే పూర్తి రిజల్యూషన్‌లో చూపబడతాయి.
Identity గుర్తింపు
Name on new comments కొత్త వ్యాఖ్యలపై చూపే పేరు
+ Hide hover previews for highlights without comment text వ్యాఖ్య వచనం లేని హైలైట్‌లకు హోవర్ ప్రివ్యూలను దాచు
Open… తెరువు…
New blank PDF కొత్త ఖాళీ PDF
Create PDF from file… ఫైల్ నుండి PDF సృష్టించు…
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 863bf28e3..7c0294e2c 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -15,6 +15,7 @@
Interface language Arayüz dili
Identity Kimlik
Name on new comments Yeni yorumlardaki ad
+ Hide hover previews for highlights without comment text Yorum metni olmayan vurgular için üzerine gelme önizlemelerini gizle
Open… Aç…
New blank PDF Yeni boş PDF
Create PDF from file… Dosyadan PDF oluştur…
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 9b893f0bf..2e8f576cb 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -32,6 +32,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. Автоматичний режим використовує розмір тексту із системних налаштувань. Сторінки завжди відображаються в повній роздільній здатності екрана.
Identity Особисті дані
Name on new comments Ім’я в нових коментарях
+ Hide hover previews for highlights without comment text Приховувати спливний перегляд для виділень без тексту коментаря
Open… Відкрити…
Open Recent Відкрити нещодавні
Pin folder to Home… Закріпити теку на головній…
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index ded03716c..dce280a6a 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -25,6 +25,7 @@
Auto ({percent}%) Tự động ({percent}%)
Identity Danh tính
Name on new comments Tên trên bình luận mới
+ Hide hover previews for highlights without comment text Ẩn bản xem trước khi di chuột cho các phần tô sáng không có nội dung nhận xét
Open… Mở…
Open Recent Mở gần đây
Clear Recent Files Xóa tệp gần đây
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 65c78c4a2..1119c904b 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -63,6 +63,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. “自动”会跟随系统的文字大小。页面始终以显示器的完整分辨率渲染。
Identity 身份
Name on new comments 新注释的作者姓名
+ Hide hover previews for highlights without comment text 隐藏无评论文字的高亮的悬停预览
Open… 打开…
Open Recent 打开最近的文件
Clear Recent Files 清除最近的文件
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 38e65dcc4..bc7c61fdd 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -22,6 +22,7 @@
Auto follows the system's text size. Pages always render at the display's full resolution. 「自動」會跟隨系統的文字大小。頁面一律以螢幕的完整解析度呈現。
Identity 個人資訊
Name on new comments 新註解的作者名稱
+ Hide hover previews for highlights without comment text 隱藏沒有註解文字的螢光標示的停留預覽
Open… 開啟…
Open Recent 開啟最近的檔案
Clear Recent Files 清除最近的檔案
diff --git a/crates/ui-egui/src/js_ui.rs b/crates/ui-egui/src/js_ui.rs
index c2ec784ef..df461fc6e 100644
--- a/crates/ui-egui/src/js_ui.rs
+++ b/crates/ui-egui/src/js_ui.rs
@@ -467,6 +467,7 @@ pub(crate) fn preferences_body(ui: &mut egui::Ui, app: &mut PdfCraftApp, t: &Tok
let label = ui.label(tl!("Name on new comments"));
ui.add(crate::widgets::line(&mut app.comment_prefs.author).desired_width(220.0).char_limit(crate::MAX_AUTHOR_CHARS)).labelled_by(label.id);
});
+ ui.add(widgets::checkbox(&mut app.comment_prefs.hide_empty_highlight_hover, tl!("Hide hover previews for highlights without comment text")));
ui.add_space(8.0);
ui.label(egui::RichText::new(tl!("Fill & Sign")).font(theme::semibold(13.0)));
ui.add(widgets::checkbox(&mut app.flatten_fill_sign_on_save, tl!("Flatten Fill & Sign when saving")));
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 6f009e54d..d101d812e 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -2277,6 +2277,8 @@ impl PdfCraftApp {
});
// Set apart: one more key inside the macro above passes serde_json's recursion limit.
v["redact_prefs"] = self.redact_defaults.to_json();
+ // Set outside json! above, which is at serde_json's macro recursion limit.
+ v["hide_empty_highlight_hover"] = serde_json::Value::Bool(self.comment_prefs.hide_empty_highlight_hover);
v.to_string()
}
@@ -2378,6 +2380,9 @@ impl PdfCraftApp {
if let Some(author) = v["author"].as_str().map(str::trim).filter(|a| !a.is_empty()) {
self.comment_prefs.author = author.chars().take(MAX_AUTHOR_CHARS).collect();
}
+ if let Some(hide) = v["hide_empty_highlight_hover"].as_bool() {
+ self.comment_prefs.hide_empty_highlight_hover = hide;
+ }
// Per-tool comment styles (#340): each field goes through its clamping setter, so a
// malformed or hostile entry is clamped or ignored rather than trusted.
if let Some(styles) = v["comment_styles"].as_array() {
@@ -2687,6 +2692,13 @@ impl PdfCraftApp {
};
}
("author", _) => self.comment_prefs.author = value.to_string(),
+ ("hide-empty-highlight-hover", _) => {
+ self.comment_prefs.hide_empty_highlight_hover = match value {
+ "true" => true,
+ "false" => false,
+ _ => return Err("hide-empty-highlight-hover must be true or false".into()),
+ };
+ }
("ui-scale", _) => self.ui_scale = ui_scale::parse(value)?,
("system-title-bar", _) => {
self.system_title_bar = match value {
diff --git a/crates/ui-egui/tests/comments.rs b/crates/ui-egui/tests/comments.rs
index b0340d027..745005240 100644
--- a/crates/ui-egui/tests/comments.rs
+++ b/crates/ui-egui/tests/comments.rs
@@ -1244,6 +1244,37 @@ fn hovering_a_comment_shows_its_author_and_text() {
assert!(h.query_by_label_contains("Check this figure").is_none(), "a dialog covers the page hover");
}
+#[test]
+fn preference_hides_author_only_highlight_hover_previews() {
+ // A highlight annotation with author Ada and empty contents over the first page.
+ let pdf = String::from_utf8_lossy(TEXT_FIXTURE).replace("/Contents 5 0 R /Resources", "/Contents 5 0 R /Annots [8 0 R] /Resources").replace(
+ "trailer",
+ "8 0 obj << /Type /Annot /Subtype /Highlight /Rect [50 50 150 120] /C [1 1 0] /T (Ada) /QuadPoints [50 120 150 120 50 50 150 50] >> endobj\ntrailer",
+ );
+ let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {
+ let mut app = PdfCraftApp::new();
+ app.set_option("language", "en").unwrap();
+ app.open_bytes("highlight_hover.pdf", None, pdf.into_bytes()).expect("opens");
+ app.set_option("left", "closed").unwrap();
+ app.set_option("panel", "none").unwrap();
+ app
+ });
+ h.run_steps(4);
+ settle(&mut h);
+
+ let p = at(&h, 100.0, 85.0);
+ // By default, author-only hover is shown.
+ h.hover_at(p);
+ h.run_steps(3);
+ h.get_by_label("Ada");
+
+ // Enabling preference hides author-only highlight hover.
+ h.state_mut().set_option("hide-empty-highlight-hover", "true").unwrap();
+ h.hover_at(p);
+ h.run_steps(3);
+ assert!(h.query_by_label("Ada").is_none(), "author-only hover must be suppressed");
+}
+
#[test]
fn the_squiggly_tool_marks_selected_text() {
let mut h = harness(|_| {});