v1.2.0: fixed right click menu backgrounds not eating pointer events
This commit is contained in:
parent
c0219c95e0
commit
4a1e7da993
|
@ -79,6 +79,22 @@ public class RightClickMenu extends Component {
|
|||
separator = new ColorBlock(1, 1, 0xFF000000);
|
||||
add(separator);
|
||||
|
||||
blocker = new PointerArea(0, 0, 0, 0){
|
||||
@Override
|
||||
public boolean onSignal(PointerEvent event) {
|
||||
boolean hit = event != null && target.overlapsScreenPoint( (int)event.current.x, (int)event.current.y );
|
||||
if (event != null && event.type == PointerEvent.Type.HOVER && !hit){
|
||||
RightClickMenu.this.destroy();
|
||||
RightClickMenu.this.killAndErase();
|
||||
} else if (hit){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
blocker.target = bg;
|
||||
add(blocker);
|
||||
|
||||
buttons = new RedButton[options.length];
|
||||
for (int i = 0; i < options.length; i++){
|
||||
int finalI = i;
|
||||
|
@ -100,17 +116,6 @@ public class RightClickMenu extends Component {
|
|||
add(buttons[i]);
|
||||
}
|
||||
|
||||
blocker = new PointerArea(0, 0, 0, 0){
|
||||
@Override
|
||||
protected void onHoverEnd(PointerEvent event) {
|
||||
RightClickMenu.this.destroy();
|
||||
RightClickMenu.this.killAndErase();
|
||||
}
|
||||
};
|
||||
blocker.blockLevel = PointerArea.NEVER_BLOCK;
|
||||
blocker.target = bg;
|
||||
add(blocker);
|
||||
|
||||
}
|
||||
|
||||
public void onSelect(int index){}
|
||||
|
|
Loading…
Reference in New Issue
Block a user