I don't think you need the conditional.  I'm guessing that you could just set yOffset to (conainer.width - scaled.width)/2 and it would work the same.  In the case where the conditional is false, I think the fit is exact anyway, and the calcuation will always yield 0.  If that is true, then you don't need the centered calculation above, and you don't need the bogus aspects.standard ratio.