From b384f7b79266872eff5fa5219cb8719cb8f4eb15 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Fri, 27 Nov 2026 14:24:02 +0300 Subject: [PATCH] =?UTF-8?q?task=2043=20review:=20hint=20stays=20dimmed=20d?= =?UTF-8?q?uring=20an=20engine=20line,=20plain=20text,=20help=20under=20?= =?UTF-8?q?=C2=ABBoard=C2=BB,=20ring=2010=C3=9710,=20reopened=20game=20kee?= =?UTF-8?q?ps=20the=20hint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/desktop/src/game_view.rs | 39 ++++++++++++++++++--------- apps/desktop/src/notation.rs | 6 +++-- apps/desktop/src/settings.rs | 16 +++++++---- apps/desktop/src/settings_ui.rs | 14 +++++----- docs/design/tasks-42-43-2026-11-27.md | 12 +++++---- 5 files changed, 55 insertions(+), 32 deletions(-) diff --git a/apps/desktop/src/game_view.rs b/apps/desktop/src/game_view.rs index 787e0f1..6814f4a 100644 --- a/apps/desktop/src/game_view.rs +++ b/apps/desktop/src/game_view.rs @@ -735,9 +735,15 @@ impl GameView { show && fresh } - /// The hint's strip: the translation strip's look, closed for good by its ×. + /// The hint's strip: the translation strip's look, closed for good by its ×; dimmed + /// (its height kept) while the board shows an engine line and takes no drawing. /// Returns whether the hint's settings changed. - fn shapes_hint_strip(&mut self, ui: &mut Ui, hint: &mut crate::settings::Hint) -> bool { + fn shapes_hint_strip( + &mut self, + ui: &mut Ui, + hint: &mut crate::settings::Hint, + dim: bool, + ) -> bool { let mut closed = false; egui::Frame::new() .fill(ui.visuals().faint_bg_color) @@ -752,15 +758,17 @@ impl GameView { egui::Layout::left_to_right(egui::Align::Center).with_main_wrap(true), |ui| { ui.set_min_height(row_h); - ui.add( - egui::Label::new(RichText::new(tr( - "Arrows and circles: drag or click with the right mouse button on the board. They are saved in the game.", - )).weak()) - .wrap(), - ) - .on_hover_text(tr( - "No key — green, Shift — red, Alt — blue, Shift+Alt — yellow. Draw the same one again to remove it. Ctrl+Z undoes.", - )); + ui.add_enabled_ui(!dim, |ui| { + ui.add( + egui::Label::new(tr( + "Arrows and circles: drag or click with the right mouse button on the board. They are saved in the game.", + )) + .wrap(), + ) + .on_hover_text(tr( + "No key — green, Shift — red, Alt — blue, Shift+Alt — yellow. Draw the same one again to remove it. Ctrl+Z undoes.", + )); + }); }, ); ui.allocate_ui_with_layout( @@ -1693,8 +1701,9 @@ impl GameView { let mut hints_changed = self.decide_shapes_hint(&mut settings.hints.board_shapes, &mut seen, translating); ui.data_mut(|d| d.insert_temp(seen_id, seen)); - if self.shapes_hint == Some(true) && !translating && self.preview.is_none() { - hints_changed |= self.shapes_hint_strip(ui, &mut settings.hints.board_shapes); + if self.shapes_hint == Some(true) && !translating { + let dim = self.preview.is_some(); + hints_changed |= self.shapes_hint_strip(ui, &mut settings.hints.board_shapes, dim); } if hints_changed { actions.push(GameAction::HintsChanged); @@ -5693,6 +5702,10 @@ mod tests { let mut b = open(1); b.decide_shapes_hint(&mut hint, &mut seen, false); assert_eq!(hint.shown, 3); + // The third counted game opened again keeps the hint, uncounted. + let mut b_again = open(1); + assert!(!b_again.decide_shapes_hint(&mut hint, &mut seen, false)); + assert_eq!((b_again.shapes_hint, hint.shown), (Some(true), 3)); // The fourth game: gone by itself. let mut c = open(2); assert!(!c.decide_shapes_hint(&mut hint, &mut seen, false)); diff --git a/apps/desktop/src/notation.rs b/apps/desktop/src/notation.rs index c753981..8850cd8 100644 --- a/apps/desktop/src/notation.rs +++ b/apps/desktop/src/notation.rs @@ -104,7 +104,8 @@ fn paint_shapes_sign( Stroke::NONE, )); } else { - painter.circle_stroke(center, SIGN / 2.0 - 0.5, stroke); + // The ring's outer edge within the sign's box, as the arrow's. + painter.circle_stroke(center, SIGN / 2.0 - 1.0, stroke); } } @@ -1340,8 +1341,9 @@ fn move_chip( .painter() .layout_no_wrap(label.to_owned(), font, text_color); let pad = vec2(4.0, 2.0); + // The sign and the chip's own right padding after it. let sign = if shapes.is_some() { - SIGN_GAP + SIGN + SIGN_GAP + SIGN + 2.0 } else { 0.0 }; diff --git a/apps/desktop/src/settings.rs b/apps/desktop/src/settings.rs index 459eeb1..dbb76fd 100644 --- a/apps/desktop/src/settings.rs +++ b/apps/desktop/src/settings.rs @@ -202,14 +202,19 @@ impl Hint { pub const SHOWS: u32 = 3; /// A game opens where the hint can stand: whether it is shown there. A show counts - /// once per game (`fresh`: the game was not opened before in this session). + /// once per game (`fresh`: the game was not shown the hint before in this session); + /// such a game keeps it, the last counted one too. pub fn offer(&mut self, fresh: bool) -> bool { - if self.done || self.shown >= Self::SHOWS { + if self.done { return false; } - if fresh { - self.shown += 1; + if !fresh { + return true; } + if self.shown >= Self::SHOWS { + return false; + } + self.shown += 1; true } } @@ -404,8 +409,9 @@ mod tests { assert!(hint.offer(true)); assert!(hint.offer(true)); assert_eq!(hint.shown, 3); + // A fourth game: gone; a game already shown in the session keeps it. assert!(!hint.offer(true)); - assert!(!hint.offer(false)); + assert!(hint.offer(false)); assert_eq!(hint.shown, 3); } diff --git a/apps/desktop/src/settings_ui.rs b/apps/desktop/src/settings_ui.rs index 39be1fa..f5a29d4 100644 --- a/apps/desktop/src/settings_ui.rs +++ b/apps/desktop/src/settings_ui.rs @@ -519,6 +519,13 @@ fn board_tab(ui: &mut Ui, s: &mut Settings, changed: &mut bool) { notation_section(ui, s, changed); ui.add_space(8.0); ui.label(RichText::new(tr("Board")).strong()); + // The hint above the notation goes away; what it told stays here, in sight. + ui.label( + RichText::new(tr( + "Arrows and circles: right mouse button on the board; Shift — red, Alt — blue, Shift+Alt — yellow. Saved in the move's comment ([%cal], [%csl]).", + )) + .weak(), + ); ui.horizontal_wrapped(|ui| { for id in BoardThemeId::ALL { let t = id.theme(); @@ -559,13 +566,6 @@ fn board_tab(ui: &mut Ui, s: &mut Settings, changed: &mut bool) { } } }); - // The hint above the notation goes away; what it told stays here. - ui.label( - RichText::new(tr( - "Arrows and circles: right mouse button on the board; Shift — red, Alt — blue, Shift+Alt — yellow. Saved in the move's comment ([%cal], [%csl]).", - )) - .weak(), - ); ui.add_space(8.0); ui.horizontal(|ui| { ui.label(tr("Piece animation")); diff --git a/docs/design/tasks-42-43-2026-11-27.md b/docs/design/tasks-42-43-2026-11-27.md index 3c1fab2..b35829e 100644 --- a/docs/design/tasks-42-43-2026-11-27.md +++ b/docs/design/tasks-42-43-2026-11-27.md @@ -315,13 +315,14 @@ **Решение:** информационная полоса **вверху панели нотации**, прямо у правого края доски. Это тот же компонент, что полоса «Комментарии на другом языке (английский) [Перевести] ×» (`chooser-ru.png`, `translate_ui.rs:1790-1840`): высота строки, перенос текста, `small_close_button`. -Новый вид не вводится. +Новый вид не вводится. Текст полосы — обычного цвета, как у полосы перевода, не weak +(ревью 2026-11-27, Д2: weak давал контраст 2,6:1, а подсказку показывают всего три раза). ``` ┌ панель нотации ─────────────────────────────────────────────┐ │ Анализ: выкл Движок не выбран ⚙ │ │ [Нотация] Справочник │ -│ Стрелки и круги: правая кнопка мыши на доске — протяните ×│ ← полоса, weak-текст, +│ Стрелки и круги: правая кнопка мыши на доске — протяните ×│ ← полоса, обычный текст, │ или щёлкните. Сохраняются в партии. │ переносится по ширине │ ┌ Intro ──────────────────────────────────────────────────┐ │ │ 1 e4 e5 ↗ │ ← признак пометок @@ -335,14 +336,15 @@ |---|---| | Где | Только обычный просмотр и анализ партии, где доска интерактивна и фигуры пишутся в партию (`game_view.rs:1441-1447`: нет просмотра линии, Maia, тренировки). В игре, тренировке, подготовке, на досках без ввода — не показывать | | Когда появляется | При открытии партии, до первой отрисовки нотации (полоса не «въезжает» во время чтения) | +| Просмотр линии движка | Полоса, уже показанная в партии, остаётся на месте приглушённой (высота та же, `×` активен), чтобы нотация не прыгала; впервые в просмотре не появляется (ревью Д1) | | Одна полоса за раз | Если видна полоса перевода, подсказка в этой партии не показывается (и не засчитывается) | | Исчезает навсегда | (а) пользователь нарисовал мышью любую стрелку или круг (б) нажал `×`. Признак `settings.hints.board_shapes = done` | -| Исчезает сама | После показа в **3** разных открытиях партии без реакции. Счётчик в настройках; одна партия, открытая повторно в той же сессии, не считается | +| Исчезает сама | После показа в **3** разных открытиях партии без реакции. Счётчик в настройках; одна партия, открытая повторно в той же сессии, не считается и подсказку сохраняет — в том числе третья засчитанная | | Закрытие внутри партии | Полоса не исчезает сама во время работы с партией (никаких таймеров): высота панели меняется только от действия пользователя (`×` или рисования). При рисовании полоса пропадает **после отпускания кнопки**, а не во время протяжки | | Подсказка текста | Цвета и снятие — в подсказке при наведении на текст полосы, не в самом тексте | Постоянное место справки (подсказка исчезает, знание должно где-то остаться): в «Настройках › -Доска и фигуры», в разделе «Доска», под образцами досок — одна weak-строка +Доска и фигуры», в разделе «Доска», сразу под его заголовком, перед образцами досок (иначе она ниже видимой части окна, ревью Д3) — одна weak-строка (`settings-board-ru.png`, по образцу «Только вид на экране. В PGN…»): «Стрелки и круги — правая кнопка мыши на доске; Shift — красный, Alt — синий, Shift+Alt — жёлтый. Сохраняются в комментарии хода ([%cal], [%csl])». @@ -381,7 +383,7 @@ | Рисование мышью (протяжка) | видна до отпускания, затем исчезает навсегда | появляется у текущего хода сразу после отпускания | | Повтор фигуры (снятие последней) | — | исчезает | | Ctrl+Z / Ctrl+Y | — | следует за партией | -| Просмотр линии движка | нет (доска не интерактивна) | у ходов партии остаётся; у ходов PV признака нет | +| Просмотр линии движка | остаётся приглушённой, высота та же | у ходов партии остаётся; у ходов PV признака нет | | Игра с Maia, тренировка | нет | нет (фигуры временные) | | Партия из базы только для чтения | видна (рисовать можно, сохранение — в свою базу по Ctrl+S, как сейчас) | да | | Видна полоса перевода | нет | да |