Skip to content

Commit

Permalink
Merge pull request #650 from OpenGeoscience/fix-transition-issue
Browse files Browse the repository at this point in the history
Fix the map jumping at the end of some transitions.
  • Loading branch information
manthey authored Dec 1, 2016
2 parents 044144e + 90d21ad commit 9f78282
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ var map = function (arg) {
}

var defaultOpts = {
center: m_this.center(undefined, null),
center: undefined,
zoom: m_this.zoom(),
rotation: m_this.rotation(),
duration: 1000,
Expand Down Expand Up @@ -1155,8 +1155,8 @@ var map = function (arg) {
opts.zCoord ? zoom2z(m_transition.start.zoom) : m_transition.start.zoom,
m_transition.start.rotation
], [
m_transition.end.center.x,
m_transition.end.center.y,
m_transition.end.center ? m_transition.end.center.x : m_transition.start.center.x,
m_transition.end.center ? m_transition.end.center.y : m_transition.start.center.y,
opts.zCoord ? zoom2z(m_transition.end.zoom) : m_transition.end.zoom,
m_transition.end.rotation
]);
Expand Down Expand Up @@ -1192,8 +1192,10 @@ var map = function (arg) {
m_transition.time = time - m_transition.start.time;
if (time >= m_transition.end.time || next) {
if (!next) {
var needZoom = m_zoom !== fix_zoom(m_transition.end.zoom);
m_this.center(m_transition.end.center, null, needZoom, needZoom);
if (m_transition.end.center) {
var needZoom = m_zoom !== fix_zoom(m_transition.end.zoom);
m_this.center(m_transition.end.center, null, needZoom, needZoom);
}
m_this.zoom(m_transition.end.zoom, m_transition.zoomOrigin);
m_this.rotation(fix_rotation(m_transition.end.rotation));
}
Expand Down

0 comments on commit 9f78282

Please sign in to comment.