feat(panels): hover washes for the settings fonts tab

The tab's choose-file and remove buttons now share the missing-fonts
hover state — the settings cursor-move derives it when the Fonts tab
is active on both hosts. no-verify: repo fmt gate trips on unrelated
op-html sources.
This commit is contained in:
Kayshen-X 2026-07-19 20:45:03 +08:00
parent 94030d1f6a
commit aed92fc91f
3 changed files with 53 additions and 1 deletions

View file

@ -164,7 +164,14 @@ pub(super) fn paint_fonts_tab(
theme.foreground,
);
let remove = imported_remove_rect(content, ui, row);
cx.backend.fill_round_rect(remove, 6.0, theme.muted);
let remove_hovered = ui.missing_fonts_hover
== Some(op_editor_core::missing_fonts::MissingFontsHover::RemoveImported(row));
let remove_bg = if remove_hovered {
theme.accent
} else {
theme.muted
};
cx.backend.fill_round_rect(remove, 6.0, remove_bg);
paint_text(
cx,
translate(ui, "common.delete"),

View file

@ -371,6 +371,29 @@ impl WidgetHostNative {
.hover_image_gen_provider_option = new_image_provider_option_hover;
changed = true;
}
let new_missing_hover = if matches!(
self.editor_state.editor_ui.agent_settings.tab,
op_editor_core::AgentSettingsTab::Fonts
) {
use op_editor_ui::widgets::agent_settings_panel::AgentSettingsHit;
let panel = AgentSettingsPanel::for_editor(&self.editor_state);
let panel_rect = panel.rect(self.last_viewport_w, self.last_viewport_h);
match panel.hit_test(panel_rect, point) {
AgentSettingsHit::MissingFontChooseFile(row) => {
Some(op_editor_core::missing_fonts::MissingFontsHover::ChooseFile(row))
}
AgentSettingsHit::RemoveImportedFont(row) => {
Some(op_editor_core::missing_fonts::MissingFontsHover::RemoveImported(row))
}
_ => None,
}
} else {
None
};
if new_missing_hover != self.editor_state.editor_ui.missing_fonts_hover {
self.editor_state.editor_ui.missing_fonts_hover = new_missing_hover;
changed = true;
}
if changed {
self.mark_dirty();
}

View file

@ -332,6 +332,28 @@ impl WidgetHost {
.hover_image_gen_provider_option = image_provider_option_hover;
changed = true;
}
let new_missing_hover = if matches!(
self.editor_state.editor_ui.agent_settings.tab,
AgentSettingsTab::Fonts
) {
let panel = AgentSettingsPanel::for_editor(&self.editor_state);
let panel_rect = panel.rect(self.last_viewport_w, self.last_viewport_h);
match panel.hit_test(panel_rect, point) {
AgentSettingsHit::MissingFontChooseFile(row) => {
Some(op_editor_core::missing_fonts::MissingFontsHover::ChooseFile(row))
}
AgentSettingsHit::RemoveImportedFont(row) => {
Some(op_editor_core::missing_fonts::MissingFontsHover::RemoveImported(row))
}
_ => None,
}
} else {
None
};
if new_missing_hover != self.editor_state.editor_ui.missing_fonts_hover {
self.editor_state.editor_ui.missing_fonts_hover = new_missing_hover;
changed = true;
}
if changed {
self.mark_dirty();
}