fixed sprite corruption, third attempt :)
@@ -229,9 +229,13 @@ static void copySelection(Sprite* sprite)
static void processSelectCanvasMouse(Sprite* sprite, s32 x, s32 y)
{
+ tic_mem* tic = sprite->tic;
+
tic_rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
const s32 Size = CANVAS_SIZE / sprite->size;
+ bool endDrag = false;
+
if(checkMousePos(&rect))
{
setCursor(tic_cursor_hand);
@@ -265,13 +269,16 @@ 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 if(sprite->select.drag)
+ else endDrag = sprite->select.drag;
+ }
+ else endDrag = !tic->ram.input.mouse.left && sprite->select.drag;
+
+ if(endDrag)
{
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)
{
