roipeker / graphx

GraphX package for Flutter.

Home Page:https://pub.dev/packages/graphx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] MouseUp event not trigger!

imiskolee opened this issue · comments

Hi:

Looks like we have a bug on mouseup event.

#1. MouseDown GShape A
#2. directly move to GShape B
#3. loosen fingers

the GShape A MouseUp event not trigger.

I think it's related to when I loosen fingers,the target element move to B, not A.
I think we need a Global event manager to handle it for 100% make sure the event mouseup can be happen after mousedown happed, alright ?

maybe we need store the last GdisplayObject on class State when MouseDown happened and focus use the cached GdisplayObject to trigger mouseup ?

I added a MouseUp handler on the parent container(GSprite), then forward event to the last mousedown element, and it's work now.

BUT, if on #2, I moved to another Container(GSprite), the issue happed again.

Would you please share some code to replicate the bug?
Please make a gists or repo with the minimum code.

Also, beware that non null-safety versions of Graphx (1.0.1 and prior) will be deprecated. So please, use the latest.

image

https://gist.github.com/imiskolee/be1f18471d6c9c52773ed0cbf4a0cb4e

#1. If we tap the element, mousedown and mouseup all of work ok, but when I tap A and move to B, we can see MouseDown A and MouseUp B

Would you please share some code to replicate the bug?
Please make a gists or repo with the minimum code.

Also, beware that non null-safety versions of Graphx (1.0.1 and prior) will be deprecated. So please, use the latest.

I am used master now

Just tested it. That's the expected behavior

@roipeker what's expected behavior? MouseDown A , then MouseUp B?

My question is I set a hover color when mousedown, and can not back to normal color sometime if can not trigger mouseup.

Thats why you use the stage for that :)

btn.onMouseDown.add((e){
btn.colorize=Colors.red;
stage.onMouseUp.addOnce((e){
btn.colorize=null;
});
})