* This is the 'meat': it resizes a slide to a certain size. In * talk mode, that size is the side of an aspect-fit box inside of * the display. In jump and print modes, that size is a certain fixed * pixel size. * * @param {HTMLElement} slideContainer * @param {number} width * @
(slideContainer, width, height)
| 307 | * @param {number} height |
| 308 | */ |
| 309 | function resizeTo(slideContainer, width, height) { |
| 310 | var slideDiv = slideContainer.firstChild; |
| 311 | var fontSize = height; |
| 312 | slideContainer.style.width = width + "px"; |
| 313 | slideContainer.style.height = height + "px"; |
| 314 | [100, 50, 10, 2].forEach(function(step) { |
| 315 | for (; fontSize > 0; fontSize -= step) { |
| 316 | slideDiv.style.fontSize = fontSize + "px"; |
| 317 | if (slideDiv.offsetWidth <= width && slideDiv.offsetHeight <= height) { |
| 318 | break; |
| 319 | } |
| 320 | } |
| 321 | fontSize += step; |
| 322 | }); |
| 323 | } |
| 324 | |
| 325 | function emptyNode(node) { |
| 326 | while (node.hasChildNodes()) { |