Wrap around both directions

This commit is contained in:
Clement Roblot 2024-10-31 21:15:59 +07:00 committed by ArthurSonzogni
parent 195871e62b
commit c9fbd8de9d
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C

View File

@ -41,19 +41,28 @@ class Text : public Node {
if (cell == "\n") { if (cell == "\n") {
continue; continue;
} }
screen.PixelAt(x, y).character = cell; Pixel &currentPixel = screen.PixelAt(x, y);
if(screen.PixelAt(x, y).selectable == true) currentPixel.character = cell;
if(currentPixel.selectable == true)
{ {
if(screen.selection_region.Contain(x, y)) { if(screen.selection_region.Contain(x, y)) {
screen.PixelAt(x, y).inverted ^= true; currentPixel.inverted ^= true;
screen.selection_text += screen.PixelAt(x, y).character; screen.selection_text += currentPixel.character;
} }
else if(screen.selection_region.x_min <= x && screen.selection_region.x_max <= x && else if(screen.selection_region.x_min <= x && screen.selection_region.x_max <= x &&
screen.selection_region.y_min <= y && screen.selection_region.y_max > y) screen.selection_region.y_min <= y && screen.selection_region.y_max > y)
{ {
screen.PixelAt(x, y).inverted ^= true; currentPixel.inverted ^= true;
screen.selection_text += screen.PixelAt(x, y).character; screen.selection_text += currentPixel.character;
} }
else if(screen.selection_region.x_min >= x && screen.selection_region.x_max >= x &&
screen.selection_region.y_min < y && screen.selection_region.y_max >= y)
{
currentPixel.inverted ^= true;
screen.selection_text += currentPixel.character;
}
} }
++x; ++x;