fixed sprite corruption, second attempt :)
@@ -231,7 +231,6 @@ static void processSelectCanvasMouse(Sprite* sprite, s32 x, s32 y)
{
tic_rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
const s32 Size = CANVAS_SIZE / sprite->size;
- bool endDrag = false;
if(checkMousePos(&rect))
{
@@ -266,16 +265,13 @@ static void processSelectCanvasMouse(Sprite* sprite, s32 x, s32 y)
sprite->select.rect = (tic_rect){sprite->select.start.x, sprite->select.start.y, 1, 1};
}
}
- else endDrag = sprite->select.drag;
- }
- else endDrag = sprite->select.drag;
-
- if(endDrag)
+ else if(sprite->select.drag)
{
copySelection(sprite);
sprite->select.drag = false;
}
}
+}
static void floodFill(Sprite* sprite, s32 l, s32 t, s32 r, s32 b, s32 x, s32 y, u8 color, u8 fill)
{
@@ -1565,6 +1561,8 @@ static void processKeyboard(Sprite* sprite)
else
{
if(hasCanvasSelection(sprite))
+ {
+ if(!sprite->select.drag)
{
if(keyWasPressed(tic_key_up)) upCanvas(sprite);
else if(keyWasPressed(tic_key_down)) downCanvas(sprite);
@@ -1572,6 +1570,7 @@ static void processKeyboard(Sprite* sprite)
else if(keyWasPressed(tic_key_right)) rightCanvas(sprite);
else if(keyWasPressed(tic_key_delete)) deleteCanvas(sprite);
}
+ }
else
{
if(keyWasPressed(tic_key_up)) upSprite(sprite);
