image rendering and visual selection
This commit is contained in:
@@ -157,6 +157,7 @@ struct GridParams {
|
||||
selection_start_row: i32,
|
||||
selection_end_col: i32,
|
||||
selection_end_row: i32,
|
||||
selection_row_max_col: array<i32, 256>,
|
||||
}
|
||||
|
||||
// GPUCell instance data (matches Rust GPUCell struct)
|
||||
@@ -187,7 +188,7 @@ struct SpriteInfo {
|
||||
var<uniform> color_table: ColorTable;
|
||||
|
||||
@group(1) @binding(1)
|
||||
var<uniform> grid_params: GridParams;
|
||||
var<storage, read> grid_params: GridParams;
|
||||
|
||||
@group(1) @binding(2)
|
||||
var<storage, read> cells: array<GPUCell>;
|
||||
@@ -277,6 +278,11 @@ fn is_cell_selected(col: u32, row: u32) -> bool {
|
||||
if grid_params.selection_start_col < 0 || grid_params.selection_start_row < 0 {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only highlight cells that have content in them or to their right on this row
|
||||
if grid_params.selection_row_max_col[row] < 0 || col > u32(grid_params.selection_row_max_col[row]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let sel_start_col = u32(grid_params.selection_start_col);
|
||||
let sel_start_row = u32(grid_params.selection_start_row);
|
||||
|
||||
Reference in New Issue
Block a user