I am learning blazor and I wanted to test moving images programmatically -- I added my handler to mousedown and mousemove and I can see I am moving images. Until the amount of movement triggers generic drag&drop mechanism and my methods are basically blocked.
So I would like to block this generic drag&drop handler and handle moving images on my own. How to do it?
Just for the record, the code:
<img src=@tile style="position:fixed; left:@(tileX)px; top:@( tileY)px; border:none;"
@onmousemove="MouseMoved" @onmousedown="MouseDown"/>
@code {
private string tile = "/images/eye.jpg";
private int tileX = 0;
private int tileY = 10;
private double mouseX = 0;
private double mouseY = 0;
private void MouseMoved(MouseEventArgs args)
{
if (args.Buttons==1)
{
tileX += (int)Math.Round(args.ScreenX - mouseX);
tileY += (int)Math.Round(args.ScreenY - mouseY);
mouseX = args.ScreenX;
mouseY = args.ScreenY;
}
}
private void MouseDown(MouseEventArgs args)
{
if (args.Buttons == 1)
{
mouseX = args.ScreenX;
mouseY = args.ScreenY;
}
}