Compare commits

...

5 Commits

Author SHA1 Message Date
Frederic Junod
f73dbc513b Update package version to 3.13.1 2016-02-03 17:04:10 +01:00
Frederic Junod
edb4f233b0 Changelog for v3.13.1 2016-02-03 17:03:28 +01:00
Guillaume Beraudo
a910ab626a Add test for URL template expansion 2016-02-03 16:54:29 +01:00
Andreas Hocevar
04db1c3e4d Expand urls before setting this.urls 2016-02-03 16:53:44 +01:00
Andreas Hocevar
b9b4778d05 Properly detect feature on unmanaged layer for toggle selection 2016-02-03 16:52:05 +01:00
7 changed files with 70 additions and 6 deletions

10
changelog/v3.13.1.md Normal file
View File

@@ -0,0 +1,10 @@
# v3.13.1
## Summary
The v3.13.1 release is a patch release that addresses a few regressions in the v3.13.0 release. See the [v3.13.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.13.0) for details on upgrading from v3.12.
## Fixes
* [#4736](https://github.com/openlayers/ol3/pull/4736) - Properly detect feature on unmanaged layer for toggle selection ([@ahocevar](https://github.com/ahocevar))
* [#4777](https://github.com/openlayers/ol3/pull/4777) - Fix source.UrlTile URL expansion ([@gberaudo](https://github.com/gberaudo))

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "3.13.0",
"version": "3.13.1",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",

View File

@@ -322,7 +322,8 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
* @param {ol.layer.Layer} layer Layer.
*/
function(feature, layer) {
if (layer !== this.featureOverlay_) {
goog.asserts.assertInstanceof(feature, ol.Feature);
if (layer !== null) {
if (add || toggle) {
if (this.filter_(feature, layer) &&
!ol.array.includes(features.getArray(), feature) &&
@@ -331,7 +332,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
this.addFeatureLayerAssociation_(feature, layer);
}
}
} else {
} else if (this.featureOverlay_.getSource().hasFeature(feature)) {
if (remove || toggle) {
deselected.push(feature);
this.removeFeatureLayerAssociation_(feature);

View File

@@ -182,9 +182,9 @@ ol.source.UrlTile.prototype.setTileUrlFunction = function(tileUrlFunction) {
* @api stable
*/
ol.source.UrlTile.prototype.setUrl = function(url) {
this.urls = [url];
var urls = ol.TileUrlFunction.expandUrl(url);
this.setTileUrlFunction(this.fixedTileUrlFunction ||
var urls = this.urls = ol.TileUrlFunction.expandUrl(url);
this.setTileUrlFunction(this.fixedTileUrlFunction ?
this.fixedTileUrlFunction.bind(this) :
ol.TileUrlFunction.createFromTemplates(urls, this.tileGrid));
};

View File

@@ -739,6 +739,16 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
};
/**
* @param {ol.Feature} feature Feature.
* @return {boolean} Feature is in source.
*/
ol.source.Vector.prototype.hasFeature = function(feature) {
var id = feature.getId();
return id ? id in this.idIndex_ : goog.getUid(feature) in this.undefIdIndex_;
};
/**
* @return {boolean} Is empty.
*/

View File

@@ -158,6 +158,38 @@ describe('ol.interaction.Select', function() {
});
});
describe('toggle selecting polygons', function() {
var select;
beforeEach(function() {
select = new ol.interaction.Select({
multi: true
});
map.addInteraction(select);
});
it('with SHIFT + single-click', function() {
var listenerSpy = sinon.spy();
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20, true);
expect(listenerSpy.callCount).to.be(1);
var features = select.getFeatures();
expect(features.getLength()).to.equal(4);
map.renderSync();
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20, true);
expect(listenerSpy.callCount).to.be(2);
features = select.getFeatures();
expect(features.getLength()).to.equal(0);
});
});
describe('filter features using the filter option', function() {
describe('with multi set to true', function() {

View File

@@ -3,6 +3,17 @@ goog.provide('ol.test.source.UrlTile');
describe('ol.source.UrlTile', function() {
describe('url option', function() {
it('expands url template', function() {
var tileSource = new ol.source.UrlTile({
url: '{1-3}'
});
var urls = tileSource.getUrls();
expect(urls).to.eql(['1', '2', '3']);
});
});
describe('tileUrlFunction', function() {
var tileSource, tileGrid;