commit 0e1437c1d83e1bc9aeeb3a9ab58dba010461ceb3
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Nov 2 10:30:44 2021 +0100

    Correct the way ObejctScale works in the TwistyObjectNode.

diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index f594f973..8c0cb829 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -234,7 +234,7 @@ public class ObjectControl
         float distQuot = mInitDistance<0 ? 1.0f : distNow/ mInitDistance;
         mInitDistance = distNow;
         TwistyObject object = mPreRender.getObject();
-        if( object!=null ) object.setObjectRatio(distQuot,mObjectNode.getScaleFactor() );
+        if( object!=null ) object.setObjectRatio(distQuot, mObjectNode.getScale(), mObjectNode.getMinSize() );
         }
       else
         {
@@ -622,7 +622,7 @@ public class ObjectControl
 
     public void scaleNow(float scale)
       {
-      mPreRender.getObject().setObjectRatioNow(scale,mObjectNode.getScaleFactor());
+      mPreRender.getObject().setObjectRatioNow(scale,mObjectNode.getScale(), mObjectNode.getMinSize() );
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index 9da0c21d..e3233627 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -116,7 +116,7 @@ public class ObjectPreRender implements EffectListener
       {
       mNewObject.setLibInterface(mInterface);
       TwistyObjectNode node = mController.getNode();
-      if( node!=null ) mNewObject.setObjectRatioNow( 1.0f, node.getScaleFactor() );
+      if( node!=null ) mNewObject.setObjectRatioNow( 1.0f, node.getScale(), node.getMinSize() );
       mController.setMovement(mNewObject.getMovement());
       if( firstTime && mPreferences!=null ) mNewObject.restorePreferences(mPreferences);
       mIsSolved = mNewObject.isSolved();
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObject.java b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
index d12fdfe9..3d34d822 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObject.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
@@ -220,7 +220,7 @@ public abstract class TwistyObject
     mRotationAngleFinal  = new Static1D(0);
 
     mObjectScale = new Static3D(1,1,1);
-    setObjectRatioNow(1.0f,720);
+    setObjectRatioNow(1.0f,1.0f,720);
 
     MatrixEffectScale scaleEffect = new MatrixEffectScale(mObjectScale);
     MatrixEffectQuaternion quatEffect  = new MatrixEffectQuaternion(mQuat, CENTER);
@@ -1118,23 +1118,23 @@ public abstract class TwistyObject
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  void setObjectRatioNow(float sc, int nodeMinSize)
+  void setObjectRatioNow(float sc, float nodeScale, int nodeMinSize)
     {
-    mObjectScreenRatio = sc;
+    mObjectScreenRatio = sc*nodeScale;
     float scale = mObjectScreenRatio*mInitScreenRatio*nodeMinSize/mSize;
     mObjectScale.set(scale,scale,scale);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  void setObjectRatio(float sizeChange, int nodeMinSize)
+  void setObjectRatio(float sizeChange, float nodeScale, int nodeMinSize)
     {
     mObjectScreenRatio *= (1.0f+sizeChange)/2;
 
     if( mObjectScreenRatio>MAX_SIZE_CHANGE) mObjectScreenRatio = MAX_SIZE_CHANGE;
     if( mObjectScreenRatio<MIN_SIZE_CHANGE) mObjectScreenRatio = MIN_SIZE_CHANGE;
 
-    setObjectRatioNow(mObjectScreenRatio, nodeMinSize);
+    setObjectRatioNow(mObjectScreenRatio, nodeScale, nodeMinSize);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObjectNode.java b/src/main/java/org/distorted/objectlib/main/TwistyObjectNode.java
index b2f9c750..6d3fbe5b 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObjectNode.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObjectNode.java
@@ -31,7 +31,7 @@ import org.distorted.library.type.Static3D;
 public class TwistyObjectNode extends DistortedNode
   {
   private final Static3D mScale;
-  private int mWidth, mHeight, mScaleFactor;
+  private int mWidth, mHeight, mMin;
   private float mCameraDist;
   private float mObjectScale;
 
@@ -56,7 +56,7 @@ public class TwistyObjectNode extends DistortedNode
     {
     mWidth      = surfaceW;
     mHeight     = surfaceH;
-    mScaleFactor= (int)(Math.min(mWidth,mHeight)*mObjectScale);
+    mMin        = Math.min(mWidth,mHeight);
 
     resizeFBO(mWidth,mHeight);
 
@@ -72,9 +72,9 @@ public class TwistyObjectNode extends DistortedNode
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  int getScaleFactor()
+  float getScale()
     {
-    return mScaleFactor;
+    return mObjectScale;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -93,7 +93,13 @@ public class TwistyObjectNode extends DistortedNode
   public void setScaleFactor(float scale)
     {
     mObjectScale = scale;
-    mScaleFactor = (int)(Math.min(mWidth,mHeight)*mObjectScale);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int getMinSize()
+    {
+    return mMin;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
