Quick explanation:
Let targetCenterPx be described by PX and PY. Let oldRes and newRes be R0 and R1 respectively. Let centerPx (center after zoom) be described by CX and CY. And assume there is some anchored pixel point out there that represents the same map location before and after zoom. Let this be the origin OX and OY.
We want to recenter the map on the provided box. This means the map distance between the origin and box center at R0 is the same as the map distance between the origin and the map center at R1.
That is,
R0 * (OX - PX) = R1 * (OX - CX), and
R1 * (OY - PY) = R1 * (OY - CY)
Or, solving for OX and OY:
OX = (R0 * PX - R1 * CX) / (R0 - R1), and
OY = (R0 * PY - R1 * CY) / (R0 - R1)
When the TileManager adds an image to its cache, it might be a backbuffer
image. Backbuffer images have an id with a '_bb' postfix. Regular images
do not have an id at all. In OpenLayers.Layer.Grid, in
addTileMonitoringHooks, a loadend listener is created for each tile. This
listener checks for tie image id, and will remove it from its parent node.
This will cause images to be removed from the layerDiv if the image comes
from the TileManager's tileCache and was on a backbuffer by the time it was
added to the cache.
Simply removing the image's id before assigning it to a tile resolves the
issue.
The properties
* layers
* queryVisible
* url
* layerUrls
* infoFormat
* vendorParams
* format
* formatOptions
should all be visible in the public API since they are essentially very
convenient to use when customizing the control.
The geodesic-property is used inside of our examples, yet isn't officially
part of the public API.
The displaySystem-property provides a very useful way of configuring the
output of the measurements and should be promoted as well.
When a layer sets a cached image's className to something else than
.olTileImage (e.g. by setting .olTileReplacing), we should not keep the
image in the cache any more, because it may no longer be valid.
This commit is a follow-up on issue #294 and commit a6119f6. Our handlers should not prevent the bubbling up of browser events. This, for example, prevents Sencha Touch's longpress events from working properly.
We need to handle the backbuffer before we fire the loadend event.
Otherwise listeners that call e.g. mergeNewParams() will cause the
backbuffer removal code to fail, because tile.imgDiv (and hence
this._transitionElement) will be null.
This change introduces a new 'replace' mode for tile transitions: when the
resolution does not change, which happens when mergeNewParams is called,
the tile will be marked with the .olTileReplace class. If this class sets
the tile's imgDiv display to 'none', the backbuffer for the tile will
immediately be removed when the tile is loaded.