Skip to content

Commit 66aa67f

Browse files
committed
Add have pixel offset to selection bounding box
1 parent 8a4e408 commit 66aa67f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

editor/src/tool/tools/select.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ impl Fsm for SelectToolFsmState {
129129
(Some([pos1, pos2]), path) => {
130130
let path = path.unwrap_or_else(|| add_boundnig_box(responses));
131131
data.bounding_box_id = Some(path.clone());
132-
let transform = transform_from_box(pos1, pos2);
132+
let half_pixel_offset = DVec2::splat(0.5);
133+
let start = pos1 + half_pixel_offset;
134+
let size = pos2 - start + half_pixel_offset;
135+
let transform = transform_from_box(start, size);
133136
Operation::SetLayerTransformInViewport { path, transform }.into()
134137
}
135138
(_, _) => Message::NoOp,
@@ -179,7 +182,7 @@ impl Fsm for SelectToolFsmState {
179182
}
180183
(DrawingBox, MouseMove) => {
181184
data.drag_current = input.mouse.position;
182-
let half_pixel_offset = DVec2::new(0.5, 0.5);
185+
let half_pixel_offset = DVec2::splat(0.5);
183186
let start = data.drag_start + half_pixel_offset;
184187
let size = data.drag_current - start + half_pixel_offset;
185188

0 commit comments

Comments
 (0)