Only create a frame state if the map has non-zero size

This is an alternative to #1490.

With this approach, event listeners get called with `null` frame state when the map has zero width or height.

As noted in the comments, I resorted to adding the `hasArea` function as a way to appease the compiler.  If the same code is placed inline in the condition for `frameState` assignment, the compiler thinks that `size` might again be `undefined`.  I'd prefer an alternative, and am open to suggestions, but the compiler also inlines this function (the resulting condition is `if (r(e) && 0 < e[0] && 0 < e[1] && r(f) && f.ud())`), so the result is the same.