imakewebthings/deck.js — pull request #62 by alexch (2012-01-16 21:40:26+00:00)
Title: scale extension scales each slide separately

The "scale" extension didn't work so well when only a few slides were really tall. It shrunk all slides as if they were as tall as the tallest one, ending up with really tiny text on all of them, not just the ones that spilled over. This patch scales each slide independently of the others, and only if necessary.

It "works for me" but here are some thoughts for possible improvement:

* There were no unit tests for the actual scaling, so all tests continue to pass. It can be hard to test sizing stuff using Jasmine so I didn't want to open that can of worms without checking with you first.

* It uses the window height as the default baseHeight (minus a "slop" of 40 pixels so scaled slides don't bleed all the way to the edge) but it might well work using $slide.outerHeight() -- it looks like Chrome at least sets outerHeight to be the visible height and innerHeight to be the full height of the content, which means that for slides taller than the window the inner height is *greater* than the outer height. I haven't checked this on all browsers so I'm sticking with windowHeight even though that cuts off the possibility of using this with decks whose container is not BODY.

* Scaled slides may have different-sized headers (H2 text) than their siblings which might violate your aesthetic sense. I can imagine a system that wraps a div around all content following the first H2 and scales that, but that seems pretty kludgey and not worth the effort.

* I edited, but didn't test, the .scss file, since I'm just using the .css file and didn't see any tools for compiling the .scss in the project (though I admit I didn't look very hard).

* So far I've only tested it with the Swiss theme.