Mobile scrolling fix
This commit is contained in:
@@ -134,7 +134,7 @@ public class MusicControl{
|
||||
|
||||
/** Plays a music track once and only once. If something is already playing, does nothing.*/
|
||||
private void playOnce(@NonNull Music music){
|
||||
if(current != null) return; //do not interrupt already-playing tracks
|
||||
if(current != null || music == null) return; //do not interrupt already-playing tracks
|
||||
|
||||
//save last random track played to prevent duplicates
|
||||
lastRandomPlayed = music;
|
||||
|
||||
@@ -67,7 +67,33 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
public MobileInput(){
|
||||
Events.on(ClientLoadEvent.class, e -> {
|
||||
Core.input.addProcessor(new GestureDetector(20, 0.5f, 0.4f, 0.15f, this));
|
||||
GestureDetector dec = new GestureDetector(20, 0.5f, 0.4f, 0.15f, this){
|
||||
boolean clearMouse = false;
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int x, int y, int pointer, KeyCode button){
|
||||
if(Core.scene.hasMouse(x, y)){
|
||||
clearMouse = true;
|
||||
return false;
|
||||
}
|
||||
return super.touchDown(x, y, pointer, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDragged(int x, int y, int pointer){
|
||||
if(!clearMouse){
|
||||
return super.touchDragged(x, y, pointer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int x, int y, int pointer, KeyCode button){
|
||||
clearMouse = false;
|
||||
return super.touchUp(x, y, pointer, button);
|
||||
}
|
||||
};
|
||||
Core.input.getInputProcessors().insert(0, dec);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user