How to drag image without the mouse going to the top corner of the image when i click and move the picture.
in
Programming Questions
•
1 year ago
int dragX, dragY;
PImage pic;
void setup()
{
size(900,900);
smooth(); //make the circle smoother
noStroke();
pic=loadImage("Nike.jpg");
image(pic,dragX,dragY);
}
void draw()
{
background(204);
image(pic, dragX, dragY); //Black Circle
}
void mouseDragged()
{
dragX = mouseX;
dragY = mouseY;
}
*From this picture, whenever i click on the image my mouse will move to the top left hand corner of the image when i drag it.
*Is it possible for me to click anywhere on the image and i can drag it anywhere i want?
1