Use correct rounding when moving selection.

This commit is contained in:
Přemysl Eric Janouch 2011-02-05 20:17:39 +01:00
parent dca71f66c3
commit 2dcf578c12
1 changed files with 6 additions and 3 deletions

View File

@ -1390,14 +1390,17 @@ static void
oper_move_selection_motion (LdCanvas *self, gdouble x, gdouble y) oper_move_selection_motion (LdCanvas *self, gdouble x, gdouble y)
{ {
MoveSelectionData *data; MoveSelectionData *data;
gdouble scale, move_x, move_y; gdouble scale, dx, dy, move_x, move_y;
gdouble move = FALSE; gdouble move = FALSE;
scale = ld_canvas_get_scale_in_px (self); scale = ld_canvas_get_scale_in_px (self);
data = &OPER_DATA (self, move_selection); data = &OPER_DATA (self, move_selection);
move_x = floor ((x - data->move_origin.x) / scale); dx = x - data->move_origin.x;
move_y = floor ((y - data->move_origin.y) / scale); dy = y - data->move_origin.y;
move_x = dx < 0 ? ceil (dx / scale) : floor (dx / scale);
move_y = dy < 0 ? ceil (dy / scale) : floor (dy / scale);
if (ABS (move_x) >= 1) if (ABS (move_x) >= 1)
{ {