Telling the compiler that object keys are numeric causes more harm
than good (see === comparison that could never be met though the
compiler didn't catch it).
Never use goog functions without reading the source first. The
goog.array.sort method does nothing special sorting numeric strings
(so the zs array might be ['1', '10', '2'] here).
The render method always generates a map of all tiles that should be drawn
(called tilesToDrawByZ). This includes tiles at alternate resolutions, tiles
still loading, and tiles previously rendered. At the end of the render
sequence we can simply remove all previously rendered tiles that aren't in
tilesToDrawByZ. This provides an alternate solution to the problem described
in #53 and more.
This brings equivalent behavior when rotating in both renderers. Previously, offsets were maintained with style top/left. Now a single transform handles the translation and rotation. The scale3d function removes the separation between tiles. The next step for the DOM renderer is to scale in this same transform.
This rather large commit refactors the build system to solve a number of
problems:
- Object literal types are now declared in just one place
- There are no more circular dependencies
- There is no need for concealed subclasses in build-standalone mode
When building in standalone mode, you need to include the source in
build/src/external. This declares object literal types as externs so
that their properties are not renamed.
When building with the application, you need to include the source in
build/src/internal. This declares object literal types as typedefs so
that their properties can be renamed and removed.
Note also that ol.MapOptions has been merged into ol.Map, with some
renaming.
ol.overlay.Overlay can be used to bind DOM elements to a
coordinate on the map. It has positioning options to support
e.g. popups or image markers that have an anchor at the bottom
and an unknown size.
The overlayContainer stops propagation on mousedown and
touchstart events, so clicks and gestures on overlays don't
trigger any MapBrowserEvent. To make this work reliably, we now
only fire dblclick in mapbrowserevent.js when there was a
previous mousedown or touchstart. The default container for
controls is now the overlayContainer.
Thanks @fredj for the inspiration. This gives us initial rotation support. It exposes some issues in the interactions that I'll address separately. Closes#22.
When zooming to a new zoom level, we can immediately remove tiles from the previous level. This (strongly) suggests not adding images to the container until they have actually loaded.
We only want to adjust things that have to do with rendering (like the position of the layers panel) when actually rendering. The handleXChange methods may be called more times than we can actually render, so we never want to do anything that touches the DOM there. Instead, we have to keep track of the state at previous render and adjust the layers panel (or other) based on changes only when rendering.
When zooming or panning, if we have tiles at alternate resolutions, those tiles are inserted in the DOM before the tiles at the target resolution. This means you should see blurry tiles instead of whitespace when panning (assuming you've already zoomed in a bit).
Tile pruning code separated into to methods for clarity. Alt-z tiles are only removed when all current-z tiles have loaded. Thanks @elemoine for the excellent debugging session.