Skip to content

Commit

Permalink
Add have pixel offset to selection bounding box
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueDoctor committed Aug 20, 2021
1 parent 8a4e408 commit e8faf21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion editor/src/tool/tools/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ impl Fsm for SelectToolFsmState {
(Some([pos1, pos2]), path) => {
let path = path.unwrap_or_else(|| add_boundnig_box(responses));
data.bounding_box_id = Some(path.clone());
let half_pixel_offset = DVec2::splat(0.5);
let pos1 = pos1 + half_pixel_offset;
let pos2 = pos2 - half_pixel_offset;
let transform = transform_from_box(pos1, pos2);
Operation::SetLayerTransformInViewport { path, transform }.into()
}
Expand Down Expand Up @@ -179,7 +182,7 @@ impl Fsm for SelectToolFsmState {
}
(DrawingBox, MouseMove) => {
data.drag_current = input.mouse.position;
let half_pixel_offset = DVec2::new(0.5, 0.5);
let half_pixel_offset = DVec2::splat(0.5);
let start = data.drag_start + half_pixel_offset;
let size = data.drag_current - start + half_pixel_offset;

Expand Down

0 comments on commit e8faf21

Please sign in to comment.