From 3cb108d3bce63818bfed78f4d31abdaf9db331c9 Mon Sep 17 00:00:00 2001 From: Nicolas Guilhaudin Date: Mon, 11 Dec 2017 19:43:28 +0100 Subject: [PATCH 1/2] Add popup options to DynamicMapLayer --- src/Layers/DynamicMapLayer.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Layers/DynamicMapLayer.js b/src/Layers/DynamicMapLayer.js index 67c3108d6..6eb13ae84 100644 --- a/src/Layers/DynamicMapLayer.js +++ b/src/Layers/DynamicMapLayer.js @@ -87,19 +87,26 @@ export var DynamicMapLayer = RasterLayer.extend({ }, this), 300); }, this); - var identifyRequest = this.identify().on(this._map).at(e.latlng); + var identifyRequest; + if (this.options.popup) { + identifyRequest = this.options.popup.at(e.latlng); + } else { + identifyRequest = this.identify().on(this._map).at(e.latlng); + } - // remove extraneous vertices from response features - identifyRequest.simplify(this._map, 0.5); + // remove extraneous vertices from response features if it has not already been done + identifyRequest.params.maxAllowableOffset ? true : identifyRequest.simplify(this._map, 0.5); - if (this.options.layers) { - identifyRequest.layers('visible:' + this.options.layers.join(',')); - } else { - identifyRequest.layers('visible'); + if (!(this.options.popup && this.options.popup.params && this.options.popup.params.layers)) { + if (this.options.layers) { + identifyRequest.layers('visible:' + this.options.layers.join(',')); + } else { + identifyRequest.layers('visible'); + } } // if present, pass layer ids and sql filters through to the identify task - if (this.options.layerDefs && typeof this.options.layerDefs !== 'string') { + if (this.options.layerDefs && typeof this.options.layerDefs !== 'string' && !identifyRequest.params.layerDefs) { for (var id in this.options.layerDefs) { if (this.options.layerDefs.hasOwnProperty(id)) { identifyRequest.layerDef(id, this.options.layerDefs[id]); From 32e14fd8a193f22bff53ad818461ab559c364949 Mon Sep 17 00:00:00 2001 From: john gravois Date: Thu, 21 Dec 2017 12:28:14 -0800 Subject: [PATCH 2/2] dont force IdentifyFeatures passed through to include a map --- karma.conf.js | 9 +++++++-- src/Layers/DynamicMapLayer.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index fc23db6e4..5c31efb91 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -13,7 +13,6 @@ module.exports = function (config) { // list of files / patterns to load in the browser // not sure why tests are failing when files are loaded in bulk - files: [ 'node_modules/leaflet/dist/leaflet.css', 'node_modules/leaflet/dist/leaflet-src.js', @@ -21,7 +20,13 @@ module.exports = function (config) { // these two are the tempermental ones 'spec/Layers/ImageMapLayerSpec.js', 'spec/Layers/DynamicMapLayerSpec.js', - 'spec/**/*Spec.js' + 'spec/Layers/BasemapLayerSpec.js', + 'spec/Layers/TiledMapLayerSpec.js', + 'spec/Layers/RasterLayerSpec.js', + // 'spec/Layers/*Spec.js', + 'spec/Tasks/*Spec.js', + 'spec/Services/*Spec.js', + 'spec/*Spec.js' ], // list of files to exclude diff --git a/src/Layers/DynamicMapLayer.js b/src/Layers/DynamicMapLayer.js index 6eb13ae84..dbe25585a 100644 --- a/src/Layers/DynamicMapLayer.js +++ b/src/Layers/DynamicMapLayer.js @@ -89,7 +89,7 @@ export var DynamicMapLayer = RasterLayer.extend({ var identifyRequest; if (this.options.popup) { - identifyRequest = this.options.popup.at(e.latlng); + identifyRequest = this.options.popup.on(this._map).at(e.latlng); } else { identifyRequest = this.identify().on(this._map).at(e.latlng); }