From 20099e1adb448fd93902cd7e4a8363e82ffa2237 Mon Sep 17 00:00:00 2001 From: vvashchenko <vitaliy.vashchenko@nic.cz> Date: Tue, 26 Jul 2016 17:02:32 +0200 Subject: [PATCH] #398 fixed puzzlePiece been rotated not to right angle. Fixed possibility of few actions to start at the same time. --- .../tablexia/util/listener/DragAndRotateActorListener.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/cz/nic/tablexia/util/listener/DragAndRotateActorListener.java b/core/src/cz/nic/tablexia/util/listener/DragAndRotateActorListener.java index 0d85f658c..5b7bd225b 100644 --- a/core/src/cz/nic/tablexia/util/listener/DragAndRotateActorListener.java +++ b/core/src/cz/nic/tablexia/util/listener/DragAndRotateActorListener.java @@ -166,10 +166,11 @@ public class DragAndRotateActorListener extends InputListener { boolean tapped = tempTouch.isTap(newTouch); if (tapped) { if (lastTouch != null) { - if (tempTouch.isDoubleTap(lastTouch)) { + if (tempTouch.isDoubleTap(lastTouch) && !lastTouch.getTouchedActor().hasActions()) { Actor actorToRotate = lastTouch.getTouchedActor(); - actorToRotate.addAction(Actions.rotateTo(actorToRotate.getRotation()-90, 0.5f)); - rotated(actorToRotate.getRotation() - 90, actorToRotate); + float newRotationAngle = ArithmeticsHelper.getClosestRightAngle(actorToRotate.getRotation()-90); + actorToRotate.addAction(Actions.rotateTo(newRotationAngle, 0.5f)); + rotated(newRotationAngle, actorToRotate); } else { lastTouch = new Touch(draggedActor, (tempTouch.getTime() + newTouch.getTime()) / 2); //not double - save least touch } -- GitLab