(gridRect, aspect)
| 199 | }); |
| 200 | |
| 201 | function adjustRectAspect(gridRect, aspect) { |
| 202 | // var outerWidth = gridRect.width + gridRect.x * 2; |
| 203 | // var outerHeight = gridRect.height + gridRect.y * 2; |
| 204 | var width = gridRect.width; |
| 205 | var height = gridRect.height; |
| 206 | if (width > height * aspect) { |
| 207 | gridRect.x += (width - height * aspect) / 2; |
| 208 | gridRect.width = height * aspect; |
| 209 | } else { |
| 210 | gridRect.y += (height - width / aspect) / 2; |
| 211 | gridRect.height = width / aspect; |
| 212 | } |
| 213 | } |