diff --git a/.travis.yml b/.travis.yml index f3389f9245..b8387b04d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,10 @@ node_js: - 8 addons: - firefox: latest # version 55.0 - 57.x have an issue with screenshots. - # firefox: 54.0.1 + # version 55.0 - 57.x have an issue with screenshots. + # version 67.0 has an issue with touch events. + # firefox: latest + firefox: 66.0.5 # We can change to a specific version of Chrome later. Versions 68 - 70 have # an issue with webgl fallback rendering. chrome: stable diff --git a/CHANGELOG.md b/CHANGELOG.md index 53b32dcba8..b200325416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## Unreleased + +### Features +- Fetch queues can have an initial size different from their regular size (#1000) + +### Improvements +- More response zooming via mouse wheel (#993) + +### Bug Fixes +- Better handling of tiles with overlap (#997) + ## Version 0.19.4 ### Improvements diff --git a/src/map.js b/src/map.js index 05174b496f..39fca1d5fb 100644 --- a/src/map.js +++ b/src/map.js @@ -355,7 +355,7 @@ var map = function (arg) { var oldCenter = m_this.center(undefined, undefined); m_gcs = arg; reset_minimum_zoom(); - var newZoom = fix_zoom(m_zoom); + var newZoom = m_this._fix_zoom(m_zoom); if (newZoom !== m_zoom) { m_this.zoom(newZoom); } @@ -417,7 +417,7 @@ var map = function (arg) { /* The ignoreDiscreteZoom flag is intended to allow non-integer zoom values * during animation. */ - val = fix_zoom(val, ignoreDiscreteZoom); + val = m_this._fix_zoom(val, ignoreDiscreteZoom); if (val === m_zoom) { return m_this; } @@ -683,7 +683,7 @@ var map = function (arg) { m_height = arg.height || m_height; reset_minimum_zoom(); - var newZoom = fix_zoom(m_zoom); + var newZoom = m_this._fix_zoom(m_zoom); if (newZoom !== m_zoom) { m_this.zoom(newZoom); } @@ -1144,7 +1144,7 @@ var map = function (arg) { }, end: { center: opts.center, - zoom: fix_zoom(opts.zoom), + zoom: m_this._fix_zoom(opts.zoom), rotation: fix_rotation(opts.rotation, undefined, true) }, ease: opts.ease, @@ -1205,7 +1205,7 @@ var map = function (arg) { if (time >= m_transition.end.time || next) { if (!next) { if (m_transition.end.center) { - var needZoom = m_zoom !== fix_zoom(m_transition.end.zoom); + var needZoom = m_zoom !== m_this._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); @@ -1236,7 +1236,7 @@ var map = function (arg) { if (m_transition.zCoord) { p[2] = z2zoom(p[2]); } - if (fix_zoom(p[2], true) === m_zoom) { + if (m_this._fix_zoom(p[2], true) === m_zoom) { m_this.center({ x: p[0], y: p[1] @@ -1408,7 +1408,7 @@ var map = function (arg) { } // calculate the zoom to fit the bounds - zoom = fix_zoom(calculate_zoom(bounds, rotation)); + zoom = m_this._fix_zoom(calculate_zoom(bounds, rotation)); // clamp bounds if necessary bounds = fix_bounds(bounds, rotation); @@ -1453,7 +1453,7 @@ var map = function (arg) { gcs = (gcs === null ? m_gcs : (gcs === undefined ? m_ingcs : gcs)); // preprocess the arguments - zoom = fix_zoom(zoom, ignoreDiscreteZoom); + zoom = m_this._fix_zoom(zoom, ignoreDiscreteZoom); units = m_this.unitsPerPixel(zoom); center = m_this.gcsToWorld(center, null); @@ -1846,6 +1846,33 @@ var map = function (arg) { return m_animationQueue[0]; }; + /** + * Return the nearest valid zoom level to the requested zoom. + * @param {number} zoom A zoom level to adjust to current settings + * @param {boolean} ignoreDiscreteZoom If `true`, ignore the `discreteZoom` + * option when determining the new view. + * @returns {number} The zoom level clamped to the allowed zoom range and + * with other settings applied. + * @private + */ + this._fix_zoom = function (zoom, ignoreDiscreteZoom) { + zoom = Math.round(zoom * 1e6) / 1e6; + zoom = Math.max( + Math.min( + m_validZoomRange.max, + zoom + ), + m_validZoomRange.min + ); + if (m_discreteZoom && !ignoreDiscreteZoom) { + zoom = Math.round(zoom); + if (zoom < m_validZoomRange.min) { + zoom = Math.ceil(m_validZoomRange.min); + } + } + return zoom; + }; + /** * Draw a layer image to a canvas context. The layer's opacity and transform * are applied. This is used as part of making a screenshot. @@ -2036,33 +2063,6 @@ var map = function (arg) { } } - /** - * Return the nearest valid zoom level to the requested zoom. - * @param {number} zoom A zoom level to adjust to current settings - * @param {boolean} ignoreDiscreteZoom If `true`, ignore the `discreteZoom` - * option when determining the new view. - * @returns {number} The zoom level clamped to the allowed zoom range and - * with other settings applied. - * @private - */ - function fix_zoom(zoom, ignoreDiscreteZoom) { - zoom = Math.round(zoom * 1e6) / 1e6; - zoom = Math.max( - Math.min( - m_validZoomRange.max, - zoom - ), - m_validZoomRange.min - ); - if (m_discreteZoom && !ignoreDiscreteZoom) { - zoom = Math.round(zoom); - if (zoom < m_validZoomRange.min) { - zoom = Math.ceil(m_validZoomRange.min); - } - } - return zoom; - } - /** * Return a valid rotation angle. * @@ -2312,7 +2312,7 @@ var map = function (arg) { // Fix the zoom level (minimum and initial) this.zoomRange(arg, true); - m_zoom = fix_zoom(m_zoom); + m_zoom = this._fix_zoom(m_zoom); m_rotation = fix_rotation(m_rotation); // Now update to the correct center and zoom level this.center($.extend({}, arg.center || m_center), undefined); diff --git a/src/mapInteractor.js b/src/mapInteractor.js index 457f92eb0e..42a1b5ba32 100644 --- a/src/mapInteractor.js +++ b/src/mapInteractor.js @@ -1603,31 +1603,36 @@ var mapInteractor = function (args) { zoom = startZoom + (targetZoom > startZoom ? 1 : -1); } } - map.transitionCancel('debounced_zoom.' + geo_action.zoom); - map.transition({ - zoom: zoom, - zoomOrigin: origin, - duration: m_options.zoomAnimation.duration, - ease: m_options.zoomAnimation.ease, - done: function (status) { - status = status || {}; - var zoomRE = new RegExp('\\.' + geo_action.zoom + '$'); - if (!status.next && (!status.cancel || - ('' + status.source).search(zoomRE) < 0)) { - targetZoom = undefined; + zoom = Math.round(map._fix_zoom(zoom) * 1e6) / 1e6; + if (zoom !== map.zoom()) { + map.transitionCancel('debounced_zoom.' + geo_action.zoom); + map.transition({ + zoom: zoom, + zoomOrigin: origin, + duration: m_options.zoomAnimation.duration, + ease: m_options.zoomAnimation.ease, + done: function (status) { + status = status || {}; + var zoomRE = new RegExp('\\.' + geo_action.zoom + '$'); + if (!status.next && (!status.cancel || + ('' + status.source).search(zoomRE) < 0)) { + targetZoom = undefined; + } + /* If we were animating the zoom, if the zoom is continuous, just + * stop where we are. If using discrete zoom, we need to make + * sure we end up discrete. However, we don't want to do that if + * the next action is further zooming. */ + if (m_options.discreteZoom && status.cancel && + status.transition && status.transition.end && + ('' + status.source).search(zoomRE) < 0) { + map.zoom(status.transition.end.zoom, + status.transition.end.zoomOrigin); + } } - /* If we were animating the zoom, if the zoom is continuous, just - * stop where we are. If using discrete zoom, we need to make - * sure we end up discrete. However, we don't want to do that if - * the next action is further zooming. */ - if (m_options.discreteZoom && status.cancel && - status.transition && status.transition.end && - ('' + status.source).search(zoomRE) < 0) { - map.zoom(status.transition.end.zoom, - status.transition.end.zoomOrigin); - } - } - }); + }); + } else { + targetZoom = undefined; + } } else { zoom = deltaZ + map.zoom(); if (m_options.discreteZoom) {