Skip to content

Commit

Permalink
Merge pull request #1031 from Biboba/issue-633
Browse files Browse the repository at this point in the history
Add popup options to DynamicMapLayer
  • Loading branch information
jgravois authored Dec 21, 2017
2 parents 2c10791 + 32e14fd commit dea46a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
9 changes: 7 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ 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',
'dist/esri-leaflet-debug.js',
// 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
Expand Down
23 changes: 15 additions & 8 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.on(this._map).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]);
Expand Down

0 comments on commit dea46a7

Please sign in to comment.