commit 72d6857c4721e2666bf70486fba1f0264707053c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Oct 6 00:23:49 2021 +0200

    off-center objects: finished.

diff --git a/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java b/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
index d146c2be..54be2378 100644
--- a/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
+++ b/src/main/java/org/distorted/objectlib/effects/win/WinEffectGlow.java
@@ -67,11 +67,10 @@ public class WinEffectGlow extends WinEffect
     degreeDyn.add(new Static1D(1.5f));
     degreeDyn.add(new Static1D(1.0f));
 
-    Static3D move = mPre.getMove();
-    float moveX = move.get0();
-    float moveY = move.get1();
-    int width = mScreen.getWidth();
-    int height= mScreen.getHeight();
+    float moveX = mPre.getMoveX();
+    float moveY = mPre.getMoveY();
+    int width   = mScreen.getWidth();
+    int height  = mScreen.getHeight();
     Static3D center = new Static3D(moveX/width, moveY/height, 0);
     float ratio = 0.5f*mObject.getRatio();
 
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index 1b3f06ed..af134a1e 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -26,7 +26,6 @@ import android.view.MotionEvent;
 
 import org.distorted.library.main.QuatHelper;
 import org.distorted.library.type.Static2D;
-import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 
 import org.distorted.objectlib.helpers.BlockController;
@@ -57,7 +56,7 @@ public class ObjectControl
     private Movement mMovement;
     private boolean mDragging, mBeginningRotation, mContinuingRotation;
     private int mScreenWidth, mScreenHeight, mScreenMin;
-    private Static3D mMove;
+    private float mMoveX, mMoveY;
 
     private float mRotAngle, mInitDistance;
     private float mStartRotX, mStartRotY;
@@ -330,8 +329,8 @@ public class ObjectControl
     private void prepareDown(MotionEvent event)
       {
       mPointer1 = event.getPointerId(0);
-      mX1 = event.getX();
-      mY1 = event.getY();
+      mX1 = event.getX() - mMoveX;
+      mY1 = event.getY() + mMoveY;
       mPointer2 = INVALID_POINTER_ID;
       }
 
@@ -343,16 +342,16 @@ public class ObjectControl
 
       if( index1>=0 )
         {
-        mX1 = event.getX(index1);
-        mY1 = event.getY(index1);
+        mX1 = event.getX(index1) - mMoveX;
+        mY1 = event.getY(index1) + mMoveY;
         }
 
       int index2 = event.findPointerIndex(mPointer2);
 
       if( index2>=0 )
         {
-        mX2 = event.getX(index2);
-        mY2 = event.getY(index2);
+        mX2 = event.getX(index2) - mMoveX;
+        mY2 = event.getY(index2) + mMoveY;
         }
       }
 
@@ -373,14 +372,14 @@ public class ObjectControl
       if( mPointer1==INVALID_POINTER_ID )
         {
         mPointer1 = event.getPointerId(index);
-        mX1 = event.getX(index);
-        mY1 = event.getY(index);
+        mX1 = event.getX(index) - mMoveX;
+        mY1 = event.getY(index) + mMoveY;
         }
       else if( mPointer2==INVALID_POINTER_ID )
         {
         mPointer2 = event.getPointerId(index);
-        mX2 = event.getX(index);
-        mY2 = event.getY(index);
+        mX2 = event.getX(index) - mMoveX;
+        mY2 = event.getY(index) + mMoveY;
         }
       }
 
@@ -489,13 +488,6 @@ public class ObjectControl
         }
       }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    Static3D getMove()
-      {
-      return mMove;
-      }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // INTERNAL API (for AutomaticControl)
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -536,7 +528,6 @@ public class ObjectControl
 
       mPreRender = new ObjectPreRender(act,this,actioner);
       mInterface = actioner;
-      mMove = new Static3D(0,0,0);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -553,8 +544,10 @@ public class ObjectControl
 
     public void setMove(int xmove, int ymove)
       {
-      mMove = new Static3D(xmove,ymove,0);
-      mPreRender.setMove(mMove);
+      mMoveX = xmove;
+      mMoveY = ymove;
+
+      mPreRender.setMove(xmove,ymove);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index c207f9a7..020b3dc7 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -47,7 +47,7 @@ public class ObjectPreRender implements EffectListener
   private final BlockController mBlockController;
   private final ObjectLibInterface mInterface;
   private String mDebug;
-  private Static3D mMove;
+  private float mMoveX, mMoveY;
 
   private boolean mFinishRotation, mRemoveRotation, mRemovePatternRotation, mAddRotation,
                   mSetQuat, mChangeObject, mSolveObject, mScrambleObject,
@@ -87,7 +87,6 @@ public class ObjectPreRender implements EffectListener
     mNewObject = null;
 
     mDebug = "";
-    mMove = new Static3D(0,0,0);
 
     mScreenWidth = 0;
     mScrambleObjectNum = 0;
@@ -106,8 +105,9 @@ public class ObjectPreRender implements EffectListener
 
     if( mOldObject!=null ) mOldObject.releaseResources();
     mOldObject = mNewObject;
+    Static3D move = new Static3D(mMoveX,mMoveY,0);
 
-    mNewObject = object.create( mController.getQuat(), mController.getMove(), mAct.get().getResources(), mScreenWidth);
+    mNewObject = object.create( mController.getQuat(), move, mAct.get().getResources(), mScreenWidth);
 
     if( mNewObject!=null )
       {
@@ -318,9 +318,10 @@ public class ObjectPreRender implements EffectListener
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  void setMove(Static3D move)
+  void setMove(float xmove, float ymove)
     {
-    mMove = move;
+    mMoveX = xmove;
+    mMoveY = ymove;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -341,9 +342,16 @@ public class ObjectPreRender implements EffectListener
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public Static3D getMove()
+  public float getMoveX()
     {
-    return mMove;
+    return mMoveX;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public float getMoveY()
+    {
+    return mMoveY;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
