ChessPenguin 0.8.6: a steady side panel, even comment sizes, no scroll bar over engine lines
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / publish (push) Has been cancelled
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / publish (push) Has been cancelled
The translation mark sat in a row with its comment, the row's width computed by subtraction; rounding made it a pixel wider than the panel and the resizable panel grew every frame (moves in comments jumped while the mouse moved). The mark is now painted in the comment's corner, outside the layout, with room kept by the frame's margin. Comments in variations use the comment size. Engine lines keep their horizontal scroll without a visible bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
758d304125
commit
f7a51c3ecb
6 changed files with 81 additions and 45 deletions
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
## [0.8.6] — 2026-10-21
|
||||
|
||||
- The side panel no longer widens by itself while a game's comments are translated (the mark
|
||||
of a translated comment made its row a pixel wider than the panel, frame after frame), so
|
||||
moves in comments no longer jump when the mouse moves over them.
|
||||
- Comments inside variations have the same size as the other comments.
|
||||
- No scroll bar pops up over the engine lines: a long line is cut at the edge (it still scrolls
|
||||
with Shift+wheel or by dragging).
|
||||
- A game whose comments go in one request shows just "Translating…": the count
|
||||
("12 of 40") is kept for long games sent in several parts.
|
||||
|
||||
|
|
|
|||
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -661,7 +661,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chess-core"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"pgn-reader",
|
||||
|
|
@ -671,7 +671,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chess-import"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
dependencies = [
|
||||
"chess-core",
|
||||
"encoding_rs",
|
||||
|
|
@ -684,7 +684,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chesspenguin"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
|
@ -4290,7 +4290,7 @@ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
|||
|
||||
[[package]]
|
||||
name = "uci"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ resolver = "3"
|
|||
members = ["crates/chess-core", "crates/chess-import", "crates/uci", "apps/desktop"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
edition = "2024"
|
||||
rust-version = "1.97"
|
||||
license = "GPL-3.0-or-later"
|
||||
|
|
|
|||
|
|
@ -1004,8 +1004,11 @@ impl GameView {
|
|||
.monospace(),
|
||||
);
|
||||
let start_num = root.as_ref().map(|p| (p.fullmoves().get(), p.turn()));
|
||||
// No bar popping up over the next line: a long line is cut at the
|
||||
// edge (it still scrolls with Shift+wheel or by dragging).
|
||||
egui::ScrollArea::horizontal()
|
||||
.id_salt(("pv", line.multipv))
|
||||
.scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::AlwaysHidden)
|
||||
.show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
for (i, san) in line.san.iter().enumerate().take(14) {
|
||||
|
|
|
|||
|
|
@ -411,8 +411,44 @@ fn translated<'a>(n: &'a Notation, text: &'a str) -> (&'a str, Option<&'a Transl
|
|||
}
|
||||
|
||||
/// "⇄" (machine translation, the original in the tooltip), "⋯" (on its way), "⚠" (failed).
|
||||
fn translation_mark(ui: &mut Ui, mark: &Translated, original: &str) {
|
||||
let (sym, color, tip, name) = match mark {
|
||||
/// "⇄" (machine translation, the original in the tooltip), "⋯" (on its way), "⚠" (failed),
|
||||
/// drawn at `at` without taking part in the layout (it may not widen the panel).
|
||||
fn translation_mark(ui: &mut Ui, at: egui::Pos2, mark: &Translated, original: &str) {
|
||||
let (sym, color, tip, name) = mark_info(ui, mark, original);
|
||||
let rect = ui.painter().text(
|
||||
at,
|
||||
Align2::RIGHT_TOP,
|
||||
sym,
|
||||
FontId::proportional(13.0),
|
||||
color,
|
||||
);
|
||||
let id = ui.id().with(("mark", at.x as i32, at.y as i32));
|
||||
let r = ui.interact(rect.expand(2.0), id, Sense::hover());
|
||||
r.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, true, name));
|
||||
r.on_hover_ui(|ui| {
|
||||
ui.set_max_width(360.0);
|
||||
ui.label(tip);
|
||||
});
|
||||
}
|
||||
|
||||
/// The mark after a comment inside a line of text (a variation): part of the flow.
|
||||
fn inline_mark(ui: &mut Ui, mark: &Translated, original: &str) {
|
||||
let (sym, color, tip, name) = mark_info(ui, mark, original);
|
||||
let r =
|
||||
ui.add(egui::Label::new(RichText::new(sym).size(13.0).color(color)).sense(Sense::hover()));
|
||||
r.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, true, name));
|
||||
r.on_hover_ui(|ui| {
|
||||
ui.set_max_width(360.0);
|
||||
ui.label(tip);
|
||||
});
|
||||
}
|
||||
|
||||
fn mark_info(
|
||||
ui: &Ui,
|
||||
mark: &Translated,
|
||||
original: &str,
|
||||
) -> (&'static str, Color32, String, &'static str) {
|
||||
match mark {
|
||||
Translated::Translated(_) => {
|
||||
let mut o: String = original.chars().take(1000).collect();
|
||||
if original.chars().count() > 1000 {
|
||||
|
|
@ -437,45 +473,31 @@ fn translation_mark(ui: &mut Ui, mark: &Translated, original: &str) {
|
|||
tr("This comment could not be translated — the original is shown. Press “Retry” in the line above the notation.").to_owned(),
|
||||
tr("Not translated"),
|
||||
),
|
||||
};
|
||||
let r =
|
||||
ui.add(egui::Label::new(RichText::new(sym).size(13.0).color(color)).sense(Sense::hover()));
|
||||
r.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, true, name));
|
||||
r.on_hover_ui(|ui| {
|
||||
ui.set_max_width(360.0);
|
||||
ui.label(tip);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Room kept on the right of a comment for its translation mark.
|
||||
const MARK_ROOM: f32 = 18.0;
|
||||
|
||||
fn comment_block(ui: &mut Ui, n: &Notation, text: &str) {
|
||||
let (shown, mark) = translated(n, text);
|
||||
block_frame(ui).show(ui, |ui| {
|
||||
let mut frame = block_frame(ui);
|
||||
if mark.is_some() {
|
||||
frame = frame.inner_margin(egui::Margin {
|
||||
left: 10,
|
||||
right: 10 + MARK_ROOM as i8,
|
||||
top: 6,
|
||||
bottom: 6,
|
||||
});
|
||||
}
|
||||
let r = frame.show(ui, |ui| {
|
||||
ui.set_width(ui.available_width());
|
||||
match mark {
|
||||
Some(m) => {
|
||||
ui.horizontal_top(|ui| {
|
||||
// A slot of its own for the mark: ⚠ is wider than ⇄.
|
||||
let w = ui.available_width() - 16.0 - ui.spacing().item_spacing.x;
|
||||
ui.allocate_ui_with_layout(
|
||||
vec2(w, 0.0),
|
||||
egui::Layout::top_down(egui::Align::Min),
|
||||
|ui| {
|
||||
ui.set_width(w);
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)).size(14.5));
|
||||
},
|
||||
);
|
||||
ui.allocate_ui_with_layout(
|
||||
vec2(16.0, 18.0),
|
||||
egui::Layout::top_down(egui::Align::Center),
|
||||
|ui| translation_mark(ui, m, text),
|
||||
);
|
||||
});
|
||||
}
|
||||
None => {
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)).size(14.5));
|
||||
}
|
||||
}
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)).size(14.5));
|
||||
});
|
||||
if let Some(m) = mark {
|
||||
let at = r.response.rect.right_top() + vec2(-8.0, 7.0);
|
||||
translation_mark(ui, at, m, text);
|
||||
}
|
||||
}
|
||||
|
||||
fn unparsed_block(ui: &mut Ui, text: &str) {
|
||||
|
|
@ -518,9 +540,9 @@ fn inline_line(ui: &mut Ui, n: &Notation, first: NodeId, out: &mut NotationRespo
|
|||
let before = comment_text(nd.comments_before());
|
||||
if !before.is_empty() {
|
||||
let (shown, mark) = translated(n, &before);
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)));
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)).size(14.5));
|
||||
if let Some(m) = mark {
|
||||
translation_mark(ui, m, &before);
|
||||
inline_mark(ui, m, &before);
|
||||
}
|
||||
need_number = true;
|
||||
}
|
||||
|
|
@ -556,9 +578,9 @@ fn inline_line(ui: &mut Ui, n: &Notation, first: NodeId, out: &mut NotationRespo
|
|||
let after = comment_text(nd.comments_after());
|
||||
if !after.is_empty() {
|
||||
let (shown, mark) = translated(n, &after);
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)));
|
||||
ui.label(RichText::new(shown).color(comment_color(ui)).size(14.5));
|
||||
if let Some(m) = mark {
|
||||
translation_mark(ui, m, &after);
|
||||
inline_mark(ui, m, &after);
|
||||
}
|
||||
need_number = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@
|
|||
<category>BoardGame</category>
|
||||
</categories>
|
||||
<releases>
|
||||
<release version="0.8.6" date="2026-10-21">
|
||||
<description>
|
||||
<p>The side panel no longer widens by itself while comments are translated; comments in variations have the usual size; no scroll bar pops up over the engine lines.</p>
|
||||
</description>
|
||||
</release>
|
||||
<release version="0.8.5" date="2026-10-21">
|
||||
<description>
|
||||
<p>Translation with a ChatGPT subscription works; short comments and text in brackets are translated too.</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue