handle pivot for Viewport.rotateMap() and .scaleMap() consistenly

This commit is contained in:
Hannes Janetzek 2014-01-28 04:59:40 +01:00
parent 2525b60f86
commit e300664a28
2 changed files with 4 additions and 4 deletions

View File

@ -588,8 +588,8 @@ public abstract class GdxMap implements ApplicationListener {
mBeginRotate = true;
mFocusX = (mWidth / 2) - (x1 + x2) / 2;
mFocusY = (mHeight / 2) - (y1 + y2) / 2;
mFocusX = (x1 + x2) / 2 - (mWidth / 2);
mFocusY = (y1 + y2) / 2 - (mHeight / 2);
} else {
double da = rad - mAngle;
mSumRotate += da;

View File

@ -477,8 +477,8 @@ public class Viewport {
double rsin = Math.sin(radians);
double rcos = Math.cos(radians);
float x = (float) (pivotX * rcos + pivotY * -rsin - pivotX);
float y = (float) (pivotX * rsin + pivotY * rcos - pivotY);
float x = (float) (-pivotX * rcos - pivotY * -rsin + pivotX);
float y = (float) (-pivotX * rsin - pivotY * rcos + pivotY);
moveMap(x, y);