GDK
Member
Below is the code I'm using for drag & drop of an object...
It all works pretty much as I need it to, except for 1 minor issue/bug (hopefully my explanation is not too confusing)...
If I move my mouse extremely fast while holding LMB down to the point where the instance falls behind the mouse position AND release LMB, the instance then becomes fixed with mouse positionand follows it until i LMB press somewhere.
This is what I don't want to happen...
I have a feeling it's due to releasing the LMB while the instance is no longer under the mouse coordinates which then causes the true and false states to glitch out.
Any ideas?
Code:
/// CREATE
selected = false;
/// STEP
if (selected){
x = mouse_x;
y = mouse_y;
}else{
x = xstart; //return to initial x location
y = ystart; //return to initial y location
}
/// LEFT PRESSED
selected = true;
/// LEFT RELEASED
selected = false;
If I move my mouse extremely fast while holding LMB down to the point where the instance falls behind the mouse position AND release LMB, the instance then becomes fixed with mouse positionand follows it until i LMB press somewhere.
This is what I don't want to happen...
I have a feeling it's due to releasing the LMB while the instance is no longer under the mouse coordinates which then causes the true and false states to glitch out.
Any ideas?