From e2bdbb1dbed15437067b0fff49f67d970abd9a4b Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Mon, 19 Dec 2016 13:14:18 +0100 Subject: [PATCH 1/5] Continue loading tiles when image is not ready yet --- src/ol/source/raster.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ol/source/raster.js b/src/ol/source/raster.js index ae085fa1cc..11176ec5e0 100644 --- a/src/ol/source/raster.js +++ b/src/ol/source/raster.js @@ -287,16 +287,19 @@ ol.source.Raster.prototype.composeFrame_ = function(frameState, callback) { imageDatas[i] = imageData; } else { // image not yet ready - return; + imageDatas = null; + break; } } - var data = {}; - this.dispatchEvent(new ol.source.Raster.Event( - ol.source.Raster.EventType.BEFOREOPERATIONS, frameState, data)); + if (imageDatas) { + var data = {}; + this.dispatchEvent(new ol.source.Raster.Event( + ol.source.Raster.EventType.BEFOREOPERATIONS, frameState, data)); - this.worker_.process(imageDatas, data, - this.onWorkerComplete_.bind(this, frameState, callback)); + this.worker_.process(imageDatas, data, + this.onWorkerComplete_.bind(this, frameState, callback)); + } frameState.tileQueue.loadMoreTiles(16, 16); }; From 3634b3dd1072e91b01e8a27df268f526b4089ff2 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 19 Dec 2016 14:00:34 -0700 Subject: [PATCH 2/5] Avoid modifying coordinate in forEachLayerAtCoordinate --- src/ol/renderer/canvas/intermediatecanvas.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/renderer/canvas/intermediatecanvas.js b/src/ol/renderer/canvas/intermediatecanvas.js index 694697c939..fe915771ab 100644 --- a/src/ol/renderer/canvas/intermediatecanvas.js +++ b/src/ol/renderer/canvas/intermediatecanvas.js @@ -129,7 +129,7 @@ ol.renderer.canvas.IntermediateCanvas.prototype.forEachLayerAtCoordinate = funct // so that for example also transparent polygons are detected return ol.renderer.canvas.Layer.prototype.forEachLayerAtCoordinate.apply(this, arguments); } else { - var pixel = ol.transform.apply(this.coordinateToCanvasPixelTransform, coordinate); + var pixel = ol.transform.apply(this.coordinateToCanvasPixelTransform, coordinate.slice()); ol.coordinate.scale(pixel, frameState.viewState.resolution / this.renderedResolution); if (!this.hitCanvasContext_) { From 7e247b258f26b8207978042dcfdb0ac5da8ed7d6 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 20 Dec 2016 13:07:00 -0700 Subject: [PATCH 3/5] Regression test --- test/spec/ol/map.test.js | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index f2cc852f38..a1b2a7926e 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -132,6 +132,68 @@ describe('ol.Map', function() { }); + describe('#forEachLayerAtPixel()', function() { + + var target, map, original, log; + + beforeEach(function(done) { + log = []; + original = ol.renderer.canvas.IntermediateCanvas.prototype.forEachLayerAtCoordinate; + ol.renderer.canvas.IntermediateCanvas.prototype.forEachLayerAtCoordinate = function(coordinate) { + log.push(coordinate.slice()); + }; + + target = document.createElement('div'); + var style = target.style; + style.position = 'absolute'; + style.left = '-1000px'; + style.top = '-1000px'; + style.width = '360px'; + style.height = '180px'; + document.body.appendChild(target); + + map = new ol.Map({ + target: target, + view: new ol.View({ + center: [0, 0], + zoom: 1 + }), + layers: [ + new ol.layer.Tile({ + source: new ol.source.XYZ() + }), + new ol.layer.Tile({ + source: new ol.source.XYZ() + }), + new ol.layer.Tile({ + source: new ol.source.XYZ() + }) + ] + }); + + map.once('postrender', function() { + done(); + }); + }); + + afterEach(function() { + ol.renderer.canvas.IntermediateCanvas.prototype.forEachLayerAtCoordinate = original; + map.dispose(); + document.body.removeChild(target); + log = null; + }); + + it('calls each layer renderer with the same coordinate', function() { + var pixel = [10, 20]; + map.forEachLayerAtPixel(pixel, function() {}); + expect(log.length).to.equal(3); + expect(log[0].length).to.equal(2); + expect(log[0]).to.eql(log[1]); + expect(log[1]).to.eql(log[2]); + }); + + }); + describe('#render()', function() { var target, map; From 0b433d3c12afd0e695baebc32a28359d11d61c75 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 20 Dec 2016 17:12:27 -0700 Subject: [PATCH 4/5] Changelog for v3.20.1 --- changelog/v3.20.1.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 changelog/v3.20.1.md diff --git a/changelog/v3.20.1.md b/changelog/v3.20.1.md new file mode 100644 index 0000000000..ce10a47910 --- /dev/null +++ b/changelog/v3.20.1.md @@ -0,0 +1,10 @@ +# v3.20.1 + +## Summary + +The v3.19.1 release is a patch release that addresses two regressions in the v3.19.0 release. See the [v3.20.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.20.0) for details on upgrading from v3.19.x. + +## Fixes + + * [#6280](https://github.com/openlayers/ol3/pull/6280) - Continue loading tiles when image is not ready yet ([@ahocevar](https://github.com/ahocevar)) + * [#6283](https://github.com/openlayers/ol3/pull/6283) - Avoid modifying coordinate in forEachLayerAtCoordinate ([@tschaub](https://github.com/tschaub)) From ad23204ba4517f212bd7893081a469646e696cfb Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 20 Dec 2016 17:13:08 -0700 Subject: [PATCH 5/5] Update package version to 3.20.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e0a37a092..a4dfcb5e2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openlayers", - "version": "3.20.0", + "version": "3.20.1", "description": "Build tools and sources for developing OpenLayers based mapping applications", "keywords": [ "map",