Skip to content

Instantly share code, notes, and snippets.

@veeneck
Created December 21, 2014 17:49
Show Gist options
  • Select an option

  • Save veeneck/7af997b8e02a1d2bcc6d to your computer and use it in GitHub Desktop.

Select an option

Save veeneck/7af997b8e02a1d2bcc6d to your computer and use it in GitHub Desktop.
Swift oddity fix
func boundScaleToWindow(scale:CGFloat) -> CGFloat {
/// Right now, this is hard coded against a 2800x1880 image sitting in a 2048x1536 window whos center is 0.5/0.5
if(scale > 1.3) {
return 1.3
}
if(scale < 0.9) {
return 0.9
}
return scale
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment