1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2025-03-12 10:49:15 +02:00

select: fix clamping for transformed outputs

This commit is contained in:
Kirill Primak 2024-06-24 14:09:08 +03:00
parent 6dc506daed
commit 13d4fa8d86

View File

@ -63,13 +63,13 @@ static void do_resize(struct dp_selection *selection, int x, int y) {
int ptr_x = x - selection->ptr_off_x, ptr_y = y - selection->ptr_off_y;
if (ptr_x < 0) {
ptr_x = 0;
} else if (ptr_x > selection->output->width) {
ptr_x = selection->output->width;
} else if (ptr_x > selection->output->transformed_width) {
ptr_x = selection->output->transformed_width;
}
if (ptr_y < 0) {
ptr_y = 0;
} else if (ptr_y > selection->output->height) {
ptr_y = selection->output->height;
} else if (ptr_y > selection->output->transformed_height) {
ptr_y = selection->output->transformed_height;
}
int width = selection->width, height = selection->height;
@ -122,13 +122,13 @@ static void do_move(struct dp_selection *selection, int x, int y) {
if (new_x < 0) {
new_x = 0;
} else if (new_x > selection->output->width - selection->width) {
new_x = selection->output->width - selection->width;
} else if (new_x > selection->output->transformed_width - selection->width) {
new_x = selection->output->transformed_width - selection->width;
}
if (new_y < 0) {
new_y = 0;
} else if (new_y > selection->output->height - selection->height) {
new_y = selection->output->height - selection->height;
} else if (new_y > selection->output->transformed_height - selection->height) {
new_y = selection->output->transformed_height - selection->height;
}
if (new_x == selection->x && new_y == selection->y) {