Desktop: the engine panel keeps its height between positions
For one frame after each move the panel had no lines (the old ones gone, the new not yet come) and was 42 px shorter: the notation below jumped up and back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
df59ff1b32
commit
8c04196d49
3 changed files with 32 additions and 1 deletions
|
|
@ -4,6 +4,10 @@ All notable changes are listed here. Versions follow [Semantic Versioning](https
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Desktop: the notation no longer jumps on every move with the engine on. Between two
|
||||
positions the old lines go at once and the new ones come a frame later; the engine
|
||||
panel now keeps their room, so what is below it stays still.
|
||||
|
||||
- The moves of the notation and the signs after them are bold (Ubuntu Bold on the desktop,
|
||||
the bold system font on Android), and so are the marks in the circles on the board. In Russian the report's rows read «Блестящий» and «Замечательный».
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@ pub struct Analysis {
|
|||
pub engine_path: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
impl Analysis {
|
||||
/// Lines the engine is asked for (the panel keeps their room while they come).
|
||||
pub fn line_count(&self) -> usize {
|
||||
self.multipv.max(1) as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl Analysis {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ pub struct GameView {
|
|||
flipped: bool,
|
||||
preview: Option<Preview>,
|
||||
scroll_to_cursor: bool,
|
||||
/// Height of one engine line in the panel (its room is kept while lines come).
|
||||
pv_row_height: f32,
|
||||
/// The comment being written (user-comments.md).
|
||||
editor: Option<CommentEditor>,
|
||||
/// A game against Maia in progress (play-mode.md).
|
||||
|
|
@ -179,6 +181,7 @@ impl GameView {
|
|||
flipped,
|
||||
preview: None,
|
||||
scroll_to_cursor: true,
|
||||
pv_row_height: 0.0,
|
||||
editor: None,
|
||||
play: None,
|
||||
play_end: None,
|
||||
|
|
@ -1602,6 +1605,10 @@ impl GameView {
|
|||
.strong()
|
||||
.size(20.0),
|
||||
);
|
||||
} else if analysis.is_on() {
|
||||
// As tall as the evaluation that is coming: the row keeps its
|
||||
// height between two positions.
|
||||
ui.label(RichText::new("…").strong().size(20.0).weak());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1703,7 +1710,7 @@ impl GameView {
|
|||
.preview
|
||||
.as_ref()
|
||||
.is_some_and(|p| p.base == base && p.san == line.san);
|
||||
ui.horizontal(|ui| {
|
||||
let row = ui.horizontal(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 3.0;
|
||||
// The line being stepped through on the board: added from here.
|
||||
if previewed
|
||||
|
|
@ -1769,6 +1776,19 @@ impl GameView {
|
|||
});
|
||||
});
|
||||
});
|
||||
self.pv_row_height = row.response.rect.height();
|
||||
}
|
||||
// Room for the lines still to come: between two positions the old lines are
|
||||
// gone at once (never shown for the new one) and the new ones come a moment
|
||||
// later; without it the notation below jumped up and back on every move.
|
||||
let missing = analysis.line_count().saturating_sub(lines.len());
|
||||
if missing > 0 {
|
||||
let row = if self.pv_row_height > 0.0 {
|
||||
self.pv_row_height
|
||||
} else {
|
||||
ui.spacing().interact_size.y
|
||||
};
|
||||
ui.add_space(missing as f32 * (row + ui.spacing().item_spacing.y));
|
||||
}
|
||||
if insert {
|
||||
self.insert_preview(actions);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue