Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve WIA Cropping #4223

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions libs/ballot-interpreter/src/hmpb-rust/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ fn build_option_layout(
let column_offset = -(grid_layout.option_bounds_from_target_mark.left as i32);
let row_offset = -(grid_layout.option_bounds_from_target_mark.top as i32);
let width: GridUnit = grid_layout.option_bounds_from_target_mark.left
+ grid_layout.option_bounds_from_target_mark.right
+ 1;
+ grid_layout.option_bounds_from_target_mark.right;
let height: GridUnit = grid_layout.option_bounds_from_target_mark.top
+ grid_layout.option_bounds_from_target_mark.bottom
+ 1;
+ grid_layout.option_bounds_from_target_mark.bottom;
Comment on lines 35 to +38
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the off-by-one issue. We're adding in 1 to the width and the height, in addition to the top + bottom or left + right specified by the gridLayouts. I imagine the original thought here was to account for the size of the bubble itself? But we don't need to do that, the measurements are from the center of the bubble in all directions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I don't know why we would have done that! Nice catch


let clamp_row =
|row: GridUnit| -> GridUnit { row.clamp(0, grid.geometry.grid_size.height - 1) };
Expand Down
Loading