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)
authors.txt file. In reality, MetaCarta does not own copyright to these files,
they merely have a right to distribute them under the license terms agreed to
by the contributors. At this point, there is no longer any reference to
MetaCarta as a copyright holder in the OpenLayers project, only to its
individual contributors via the authors.txt file.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10706 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
to finish this one up. All commits are in comments, so a review doesn't seem
strictly neccesary. This closes#918 and fixes all the copyrights that I could
find in the code.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3984 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who
helped out in making this happen. (I could list people, but the list would
be long, and I'm already mentally on vacation.)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf