// "Set to Current" choice
if (newOrigin == 4)
{
newOrigin = 3;
Vector3[] sides = targetRect.GetSides(myRect.cachedTransform);
float f0, f1;
if (IsHorizontal[index])
{
f0 = sides[0].x;
f1 = sides[2].x;
}
else
{
f0 = sides[3].y;
f1 = sides[1].y;
}
// Final position after both relative and absolute values are taken into consideration
float final = Mathf.Floor(0.5f + Mathf.Lerp(0f, f1 - f0, rel.floatValue) + abs.intValue);
rel.floatValue = final / (f1 - f0);
abs.intValue = 0;
serializedObject.ApplyModifiedProperties();
serializedObject.Update();
}