MCPcopy
hub / github.com/tmcw/big / resizeTo

Function resizeTo

lib/big.js:309–323  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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()) {

Callers 3

onPrintFunction · 0.85
onJumpFunction · 0.85
onResizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected