Look: active form field editor is pale yellow with a blue border; stamp group headings uppercase

This commit is contained in:
Dylan M. Taylor committed 2026-11-22 20:09:57 -05:00
1 parent de19965003
commit 4a0001ea0d
3 files changed
+9 -3

No files matched your search

+1 -1
View File
@@ -199,7 +199,7 @@ pub(super) fn stamp_palette(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
for (n, (group, title)) in titles.iter().enumerate() {
let start = kinds.len();
kinds.extend(StampKind::ALL.into_iter().filter(|k| k.group() == *group).map(|k| (*group, k)));
groups.push(TileGroup::new(1_000_000 + n, start, kinds.len() - start, title.to_string()));
groups.push(TileGroup::new(1_000_000 + n, start, kinds.len() - start, title.to_uppercase()));
}
let mut selection = match app.quick_tool {
crate::QuickTool::Stamp(current) => kinds.iter().position(|(_, kind)| *kind == current).map(Selection::single).unwrap_or_default(),
+4
View File
@@ -34,6 +34,10 @@ use choice_list::choice_list;
/// The page's paper: what an unbaked widget is filled with until its appearance is rendered.
const PAPER: Color32 = Color32::WHITE;
/// Background of the in-place text field editor, the same in every theme (as production).
const FIELD_FILL: Color32 = Color32::from_rgb(0xFF, 0xFF, 0xF4);
/// Border of the field being edited.
const FOCUS_BLUE: Color32 = Color32::from_rgb(0x14, 0x73, 0xE6);
/// The field being edited.
#[derive(Clone, Debug, PartialEq)]
+4 -2
View File
@@ -19,7 +19,7 @@ use egui::{Align, Color32, CornerRadius, FontId, Pos2, Rect, pos2, vec2};
use pdfcraft_engine::{Document, FormField, FormFieldKind, FormWidget, field_flags, form_appearance};
use pdfcraft_render::DocInfo;
use super::{Focus, PAPER, TextFrame, commit, editable_combo, field_screen_font, focused_field, list_pick_edit, widget_rect};
use super::{FIELD_FILL, FOCUS_BLUE, Focus, TextFrame, commit, editable_combo, field_screen_font, focused_field, list_pick_edit, widget_rect};
use crate::canvas::{PageGeometry, PageSession};
/// Where a field's text is laid out: its frame on the page and the screen points per page point.
@@ -381,7 +381,9 @@ pub(crate) fn show(
let mut host = FieldHost { ctx: ui.ctx().clone(), view: body.view, field: f, widget: w, geo, room, text, caret: selection.caret, laid: None };
// PLAN: paints through an egui `Painter` with black text, as pdf-forms-w7's `paint_page` does; both move to the `Draw` tokens and the field's `/DA` colour together.
let painter = ui.painter_at(rect.intersect(body.rect));
painter.rect_filled(rect, CornerRadius::ZERO, PAPER);
painter.rect_filled(rect, CornerRadius::ZERO, FIELD_FILL);
// The field being typed in carries a blue border, as production draws it.
painter.rect_stroke(rect, CornerRadius::ZERO, egui::Stroke::new(1.5, FOCUS_BLUE), egui::StrokeKind::Inside);
host.with(|laid, _| laid.paint(&painter));
let multiline = f.kind == FormFieldKind::Text && f.has(field_flags::MULTILINE);
let editor = TextEditor::new(f.name.clone(), &mut host, Bind::bound(selection))