Skip to content

Commit

Permalink
Merge pull request #21 from iamletmethink/patch-10
Browse files Browse the repository at this point in the history
Fix: "Scale to Fit (Letterbox)" crops off the edges
  • Loading branch information
darioseidl committed Apr 7, 2016
2 parents 574df25 + 4be5f14 commit 48b4641
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions Universal.hx
Expand Up @@ -480,17 +480,8 @@ class Universal extends Sprite
//Scale to Fit: Letterboxed
if(MyAssets.scaleToFit1)
{
if(MyAssets.landscape)
{
scaleX *= stageWidth / MyAssets.stageWidth;
scaleY = scaleX;
}

else
{
scaleY = stageHeight / MyAssets.stageHeight;
scaleX = scaleY;
}
scaleX *= Math.min(stageWidth / MyAssets.stageWidth, stageHeight / MyAssets.stageHeight);
scaleY = scaleX;

if(widescreen || (screenLandscape && screenW < screenH) || (!screenLandscape && screenW > screenH))
{
Expand All @@ -506,17 +497,8 @@ class Universal extends Sprite
//Scale to Fit: Fill/Cropped
else if(MyAssets.scaleToFit2)
{
if(MyAssets.landscape)
{
scaleY = stageHeight / MyAssets.stageHeight;
scaleX = scaleY;
}

else
{
scaleX *= stageWidth / MyAssets.stageWidth;
scaleY = scaleX;
}
scaleX *= Math.max(stageWidth / MyAssets.stageWidth, stageHeight / MyAssets.stageHeight);
scaleY = scaleX;

if(widescreen || (screenLandscape && screenW < screenH) || (!screenLandscape && screenW > screenH))
{
Expand Down

0 comments on commit 48b4641

Please sign in to comment.