v0.6.1b: fixed a rare ANR caused by motion interruption

This commit is contained in:
Evan Debenham 2017-08-23 01:48:57 -04:00
parent ff28b2314a
commit 68e0916cf5
2 changed files with 10 additions and 1 deletions

View File

@ -44,6 +44,11 @@ abstract public class Tweener extends Gizmo {
@Override
public void update() {
if (elapsed < 0){
onComplete();
kill();
return;
}
elapsed += Game.elapsed;
if (elapsed >= interval) {
updateValues( 1 );
@ -54,6 +59,10 @@ abstract public class Tweener extends Gizmo {
}
}
public void stop( boolean complete ){
elapsed = complete ? interval : -1;
}
protected void onComplete() {
if (listener != null) {
listener.onComplete( this );

View File

@ -185,7 +185,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
public void interruptMotion() {
if (motion != null) {
onComplete( motion );
motion.stop(false);
}
}