Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a73335839 | ||
|
|
124badb961 | ||
|
|
8725b4fcf4 | ||
|
|
d12dce1c03 | ||
|
|
afb8efc0e9 | ||
|
|
bef31dc386 | ||
|
|
e8cd5e322f |
13
changelog/v3.14.2.md
Normal file
13
changelog/v3.14.2.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# v3.14.2
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.14.2 release is a patch release that addresses a few regressions in the v3.14.1 release. See the [v3.14.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.14.0) for details on upgrading from v3.13.x.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4963](https://github.com/openlayers/ol3/pull/4963) - Handle more XHR errors in the TileJSON source ([@tschaub](https://github.com/tschaub))
|
||||
* [#4960](https://github.com/openlayers/ol3/pull/4960) - Simplify clipping of lower resolution regions ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4958](https://github.com/openlayers/ol3/pull/4958) - Stop wheel events instead of DOMMouseScroll events ([@fredj](https://github.com/fredj))
|
||||
* [#4956](https://github.com/openlayers/ol3/pull/4956) - Fix Examples layout page ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4809](https://github.com/openlayers/ol3/pull/4809) - Fix multipolygon clone. ([@fperucic](https://github.com/fperucic))
|
||||
@@ -18,8 +18,10 @@
|
||||
<body>
|
||||
|
||||
<header class="navbar" role="navigation">
|
||||
<div class="container" id="navbar-inner-container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<div class="container">
|
||||
<div class="display-table pull-left" id="navbar-logo-container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
</div>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="../doc">Docs</a></li>
|
||||
<li><a class="active" href="index.html">Examples</a></li>
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
body {
|
||||
padding-top: 70px;
|
||||
}
|
||||
.navbar-form {
|
||||
margin-top: 12px;
|
||||
}
|
||||
input.search-query {
|
||||
color: #333;
|
||||
}
|
||||
@@ -186,11 +183,13 @@
|
||||
|
||||
<header class="navbar navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<form class="navbar-form navbar-left search-form" role="search">
|
||||
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
||||
<span id="count"></span>
|
||||
</form>
|
||||
<div class="display-table pull-left">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<form class="navbar-form" role="search">
|
||||
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
||||
<span id="count"></span>
|
||||
</form>
|
||||
</div>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="../doc">Docs</a></li>
|
||||
<li><a class="active" href="index.html">Examples</a></li>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var container = document.getElementById('navbar-inner-container');
|
||||
var container = document.getElementById('navbar-logo-container');
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
select.className = 'input-medium';
|
||||
|
||||
form.className = 'navbar-form pull-right version-form';
|
||||
form.className = 'navbar-form version-form';
|
||||
form.appendChild(select);
|
||||
|
||||
container.appendChild(form);
|
||||
|
||||
@@ -32,12 +32,15 @@ body {
|
||||
.navbar-nav>li>a {
|
||||
color: white;
|
||||
}
|
||||
.search-form, .version-form {
|
||||
position: absolute;
|
||||
left: 450px;
|
||||
.display-table {
|
||||
display: table;
|
||||
}
|
||||
.version-form, .navbar-form {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.version-form {
|
||||
top: 5px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#title {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openlayers",
|
||||
"version": "3.14.1",
|
||||
"version": "3.14.2",
|
||||
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
||||
"keywords": [
|
||||
"map",
|
||||
|
||||
@@ -122,7 +122,7 @@ ol.geom.MultiPolygon.prototype.clone = function() {
|
||||
var len = this.endss_.length;
|
||||
var newEndss = new Array(len);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
newEndss[i] = this.endss_.slice();
|
||||
newEndss[i] = this.endss_[i].slice();
|
||||
}
|
||||
|
||||
multiPolygon.setFlatCoordinates(
|
||||
|
||||
@@ -291,7 +291,8 @@ ol.Map = function(options) {
|
||||
ol.events.EventType.TOUCHSTART,
|
||||
ol.events.EventType.MSPOINTERDOWN,
|
||||
ol.MapBrowserEvent.EventType.POINTERDOWN,
|
||||
goog.userAgent.GECKO ? 'DOMMouseScroll' : ol.events.EventType.MOUSEWHEEL
|
||||
ol.events.EventType.MOUSEWHEEL,
|
||||
ol.events.EventType.WHEEL
|
||||
];
|
||||
for (var i = 0, ii = overlayEvents.length; i < ii; ++i) {
|
||||
ol.events.listen(this.overlayContainerStopEvent_, overlayEvents[i],
|
||||
|
||||
@@ -9,7 +9,6 @@ goog.require('ol.array');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.render.EventType');
|
||||
goog.require('ol.renderer.canvas.Layer');
|
||||
goog.require('ol.source.Tile');
|
||||
@@ -24,12 +23,6 @@ ol.renderer.canvas.TileLayer = function(tileLayer) {
|
||||
|
||||
goog.base(this, tileLayer);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object.<string, Array.<ol.TileCoord>>}
|
||||
*/
|
||||
this.clipTileCoords_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {CanvasRenderingContext2D}
|
||||
@@ -95,60 +88,56 @@ ol.renderer.canvas.TileLayer.prototype.composeFrame = function(
|
||||
var tileGrid = source.getTileGridForProjection(projection);
|
||||
var tilesToDraw = this.renderedTiles_;
|
||||
|
||||
var clipExtent, clipH, clipLeft, clipOrigin, clipTileCoord, clipTileCoords;
|
||||
var clipTop, clipW, currentZ, h, i, ii, j, jj, left, origin, tile, tileExtent;
|
||||
var tilePixelSize, top, w;
|
||||
for (i = 0, ii = tilesToDraw.length; i < ii; ++i) {
|
||||
tile = tilesToDraw[i];
|
||||
tileExtent = tileGrid.getTileCoordExtent(
|
||||
tile.getTileCoord(), this.tmpExtent_);
|
||||
currentZ = tile.getTileCoord()[0];
|
||||
var pixelExtents;
|
||||
var opaque = source.getOpaque(projection) && layerState.opacity == 1;
|
||||
if (!opaque) {
|
||||
tilesToDraw.reverse();
|
||||
pixelExtents = [];
|
||||
}
|
||||
for (var i = 0, ii = tilesToDraw.length; i < ii; ++i) {
|
||||
var tile = tilesToDraw[i];
|
||||
var tileCoord = tile.getTileCoord();
|
||||
var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);
|
||||
var currentZ = tileCoord[0];
|
||||
// Calculate all insert points by tile widths from a common origin to avoid
|
||||
// gaps caused by rounding
|
||||
origin = ol.extent.getBottomLeft(tileGrid.getTileCoordExtent(
|
||||
var origin = ol.extent.getBottomLeft(tileGrid.getTileCoordExtent(
|
||||
tileGrid.getTileCoordForCoordAndZ(center, currentZ)));
|
||||
w = Math.round(ol.extent.getWidth(tileExtent) * pixelScale);
|
||||
h = Math.round(ol.extent.getHeight(tileExtent) * pixelScale);
|
||||
left = Math.round((tileExtent[0] - origin[0]) * pixelScale / w) * w +
|
||||
var w = Math.round(ol.extent.getWidth(tileExtent) * pixelScale);
|
||||
var h = Math.round(ol.extent.getHeight(tileExtent) * pixelScale);
|
||||
var left = Math.round((tileExtent[0] - origin[0]) * pixelScale / w) * w +
|
||||
offsetX + Math.round((origin[0] - center[0]) * pixelScale);
|
||||
top = Math.round((origin[1] - tileExtent[3]) * pixelScale / h) * h +
|
||||
var top = Math.round((origin[1] - tileExtent[3]) * pixelScale / h) * h +
|
||||
offsetY + Math.round((center[1] - origin[1]) * pixelScale);
|
||||
clipTileCoords = this.clipTileCoords_[tile.tileCoord.toString()];
|
||||
if (clipTileCoords) {
|
||||
// Create a clip mask for regions in this low resolution tile that will be
|
||||
// filled by a higher resolution tile
|
||||
if (!opaque) {
|
||||
var pixelExtent = [left, top, left + w, top + h];
|
||||
// Create a clip mask for regions in this low resolution tile that are
|
||||
// already filled by a higher resolution tile
|
||||
renderContext.save();
|
||||
renderContext.beginPath();
|
||||
// counter-clockwise (outer ring) for current tile
|
||||
renderContext.moveTo(left + w, top);
|
||||
renderContext.lineTo(left, top);
|
||||
renderContext.lineTo(left, top + h);
|
||||
renderContext.lineTo(left + w, top + h);
|
||||
renderContext.closePath();
|
||||
// clockwise (inner rings) for lower resolution tiles
|
||||
for (j = 0, jj = clipTileCoords.length; j < jj; ++j) {
|
||||
clipTileCoord = clipTileCoords[j];
|
||||
clipExtent = tileGrid.getTileCoordExtent(clipTileCoord);
|
||||
clipOrigin = ol.extent.getBottomLeft(tileGrid.getTileCoordExtent(
|
||||
tileGrid.getTileCoordForCoordAndZ(center, clipTileCoord[0])));
|
||||
clipW = Math.round(ol.extent.getWidth(clipExtent) * pixelScale);
|
||||
clipH = Math.round(ol.extent.getHeight(clipExtent) * pixelScale);
|
||||
clipLeft = Math.round((clipExtent[0] - clipOrigin[0]) * pixelScale / clipW) * clipW +
|
||||
offsetX + Math.round((clipOrigin[0] - center[0]) * pixelScale);
|
||||
clipTop = Math.round((clipOrigin[1] - clipExtent[3]) * pixelScale / clipH) * clipH +
|
||||
offsetY + Math.round((center[1] - clipOrigin[1]) * pixelScale);
|
||||
renderContext.moveTo(clipLeft, clipTop + clipH);
|
||||
renderContext.lineTo(clipLeft, clipTop);
|
||||
renderContext.lineTo(clipLeft + clipW, clipTop);
|
||||
renderContext.lineTo(clipLeft + clipW, clipTop + clipH);
|
||||
renderContext.closePath();
|
||||
for (var j = 0, jj = pixelExtents.length; j < jj; ++j) {
|
||||
var clipExtent = pixelExtents[j];
|
||||
if (ol.extent.intersects(pixelExtent, clipExtent)) {
|
||||
renderContext.beginPath();
|
||||
// counter-clockwise (outer ring) for current tile
|
||||
renderContext.moveTo(pixelExtent[0], pixelExtent[1]);
|
||||
renderContext.lineTo(pixelExtent[0], pixelExtent[3]);
|
||||
renderContext.lineTo(pixelExtent[2], pixelExtent[3]);
|
||||
renderContext.lineTo(pixelExtent[2], pixelExtent[1]);
|
||||
// clockwise (inner ring) for higher resolution tile
|
||||
renderContext.moveTo(clipExtent[0], clipExtent[1]);
|
||||
renderContext.lineTo(clipExtent[2], clipExtent[1]);
|
||||
renderContext.lineTo(clipExtent[2], clipExtent[3]);
|
||||
renderContext.lineTo(clipExtent[0], clipExtent[3]);
|
||||
renderContext.closePath();
|
||||
renderContext.clip();
|
||||
}
|
||||
}
|
||||
renderContext.clip();
|
||||
pixelExtents.push(pixelExtent);
|
||||
}
|
||||
tilePixelSize = source.getTilePixelSize(currentZ, pixelRatio, projection);
|
||||
var tilePixelSize = source.getTilePixelSize(currentZ, pixelRatio, projection);
|
||||
renderContext.drawImage(tile.getImage(), tileGutter, tileGutter,
|
||||
tilePixelSize[0], tilePixelSize[1], left, top, w, h);
|
||||
if (clipTileCoords) {
|
||||
if (!opaque) {
|
||||
renderContext.restore();
|
||||
}
|
||||
}
|
||||
@@ -266,33 +255,6 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(
|
||||
}
|
||||
}
|
||||
this.renderedTiles_ = renderables;
|
||||
ol.object.clear(this.clipTileCoords_);
|
||||
if (!(tileSource.getOpaque(projection) && layerState.opacity == 1)) {
|
||||
var clipTileCoords = this.clipTileCoords_;
|
||||
var tileCoord;
|
||||
for (i = renderables.length - 1; i >= 0; --i) {
|
||||
tileCoord = renderables[i].getTileCoord();
|
||||
tileGrid.forEachTileCoordParentTileRange(tileCoord,
|
||||
function(z, tileRange) {
|
||||
var tiles = tilesToDrawByZ[z];
|
||||
if (tiles) {
|
||||
var key, tile;
|
||||
for (key in tiles) {
|
||||
tile = tiles[key];
|
||||
if (tileRange.contains(tile.getTileCoord()) &&
|
||||
tile.getState() == ol.TileState.LOADED) {
|
||||
if (!(key in clipTileCoords)) {
|
||||
clipTileCoords[key] = [];
|
||||
}
|
||||
clipTileCoords[key].push(tileCoord);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}, this, tmpTileRange, tmpExtent);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateUsedTiles(frameState.usedTiles, tileSource, z, tileRange);
|
||||
this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio,
|
||||
|
||||
@@ -43,23 +43,47 @@ ol.source.TileJSON = function(options) {
|
||||
ol.net.jsonp(options.url, this.handleTileJSONResponse.bind(this),
|
||||
this.handleTileJSONError.bind(this));
|
||||
} else {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', options.url, true);
|
||||
xhr.onload = function(e) {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
var response = /** @type {TileJSON} */(JSON.parse(xhr.responseText));
|
||||
this.handleTileJSONResponse(response);
|
||||
} else {
|
||||
this.handleTileJSONError();
|
||||
}
|
||||
}.bind(this);
|
||||
xhr.send();
|
||||
var client = new XMLHttpRequest();
|
||||
client.addEventListener('load', this.onXHRLoad_.bind(this));
|
||||
client.addEventListener('error', this.onXHRError_.bind(this));
|
||||
client.open('GET', options.url);
|
||||
client.send();
|
||||
}
|
||||
|
||||
};
|
||||
goog.inherits(ol.source.TileJSON, ol.source.TileImage);
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Event} event The load event.
|
||||
*/
|
||||
ol.source.TileJSON.prototype.onXHRLoad_ = function(event) {
|
||||
var client = /** @type {XMLHttpRequest} */ (event.target);
|
||||
if (client.status >= 200 && client.status < 300) {
|
||||
var response;
|
||||
try {
|
||||
response = /** @type {TileJSON} */(JSON.parse(client.responseText));
|
||||
} catch (err) {
|
||||
this.handleTileJSONError();
|
||||
return;
|
||||
}
|
||||
this.handleTileJSONResponse(response);
|
||||
} else {
|
||||
this.handleTileJSONError();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Event} event The error event.
|
||||
*/
|
||||
ol.source.TileJSON.prototype.onXHRError_ = function(event) {
|
||||
this.handleTileJSONError();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {TileJSON} tileJSON Tile JSON.
|
||||
|
||||
@@ -88,6 +88,15 @@ describe('ol.geom.MultiPolygon', function() {
|
||||
[[[3, 0], [4, 1], [5, 2], [5, 0]]]);
|
||||
});
|
||||
|
||||
describe('#clone()', function() {
|
||||
|
||||
it('has the expected endss_', function() {
|
||||
var clone = multiPolygon.clone();
|
||||
expect(multiPolygon.endss_).to.eql(clone.endss_);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getCoordinates()', function() {
|
||||
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
|
||||
@@ -4,14 +4,32 @@ goog.provide('ol.test.source.TileJSON');
|
||||
describe('ol.source.TileJSON', function() {
|
||||
|
||||
describe('#getState', function() {
|
||||
|
||||
it('returns ol.source.State.ERROR on HTTP 404', function() {
|
||||
var changeSpy = sinon.spy(function(event) {
|
||||
expect(event.target.getState()).to.eql('error');
|
||||
});
|
||||
var source = new ol.source.TileJSON({
|
||||
url: 'invalid.jsonp'
|
||||
});
|
||||
ol.events.listen(source, 'change', changeSpy);
|
||||
source.on('change', function() {
|
||||
expect(source.getState()).to.eql('error');
|
||||
});
|
||||
});
|
||||
|
||||
it('returns ol.source.State.ERROR on CORS issues', function() {
|
||||
var source = new ol.source.TileJSON({
|
||||
url: 'http://example.com'
|
||||
});
|
||||
source.on('change', function() {
|
||||
expect(source.getState()).to.eql('error');
|
||||
});
|
||||
});
|
||||
|
||||
it('returns ol.source.State.ERROR on JSON parsing issues', function() {
|
||||
var source = new ol.source.TileJSON({
|
||||
url: '/'
|
||||
});
|
||||
source.on('change', function() {
|
||||
expect(source.getState()).to.eql('error');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user