feat: Centrado vertical texto y x_offset para botones

Cambios:
- base.zig: Añadido x_offset a ActionButtonsOpts y NavButtonsOpts
- text_input.zig: char_height 8→16 para fuente 8x16
- table/render.zig: char_height 8→16 (header y celdas)

El centrado vertical del texto ahora funciona correctamente
con fuentes 8x16 (VGA standard).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
reugenio 2025-12-14 21:22:23 +01:00
parent 75613ec23f
commit 1a5529dd5b
3 changed files with 12 additions and 5 deletions

View file

@ -76,6 +76,8 @@ pub const ActionButtonsOpts = struct {
button_height: u32 = 28,
/// Espacio entre botones
spacing: i32 = 8,
/// Offset X desde el borde izquierdo del panel
x_offset: i32 = 8,
};
/// Opciones para botones de navegacion
@ -96,6 +98,8 @@ pub const NavButtonsOpts = struct {
button_width: u32 = 40,
/// Alto de cada boton
button_height: u32 = 28,
/// Offset X desde el borde izquierdo del panel
x_offset: i32 = 8,
};
// =============================================================================
@ -266,7 +270,7 @@ pub const DetailPanelBase = struct {
_ = self;
var result = ActionButtonsResult{};
const x = rect.x + 8;
const x = rect.x + opts.x_offset;
const bw = opts.button_width;
const bh = opts.button_height;
const sp = opts.spacing;
@ -321,7 +325,7 @@ pub const DetailPanelBase = struct {
_ = self;
var result = NavButtonsResult{};
const x = rect.x + 8;
const x = rect.x + opts.x_offset;
const bw = opts.button_width;
const bh = opts.button_height;

View file

@ -68,7 +68,8 @@ pub fn drawHeader(
var col_x = bounds.x + @as(i32, @intCast(state_col_w));
// Draw column headers
const char_height: u32 = 8;
// Use 16 for 8x16 fonts (VGA standard, better readability)
const char_height: u32 = 16;
const text_y = header_bounds.y + @as(i32, @intCast((config.header_height -| char_height) / 2));
for (columns, 0..) |col, col_idx| {
@ -191,7 +192,8 @@ pub fn drawRow(
// Draw cells
var col_x = row_bounds.x + @as(i32, @intCast(state_col_w));
const char_height: u32 = 8;
// Use 16 for 8x16 fonts (VGA standard, better readability)
const char_height: u32 = 16;
const text_y = row_bounds.y + @as(i32, @intCast((config.row_height -| char_height) / 2));
for (columns, 0..) |col, col_idx| {

View file

@ -338,7 +338,8 @@ pub fn textInputRect(
const display_color = if (state.len == 0) placeholder_color else text_color;
// Calculate text position (left-aligned, vertically centered)
const char_height: u32 = 8;
// Use 16 for 8x16 fonts (VGA standard, better readability)
const char_height: u32 = 16;
const text_y = inner.y + @as(i32, @intCast((inner.h -| char_height) / 2));
if (config.password and state.len > 0) {