diff --git a/assets/src/modules/Popup.js b/assets/src/modules/Popup.js index c25b22f893..b1e0369251 100644 --- a/assets/src/modules/Popup.js +++ b/assets/src/modules/Popup.js @@ -118,6 +118,7 @@ export default class Popup { const filterTokens = []; const legendOn = []; const legendOff = []; + let popupMaxFeatures = 10; for (const layer of candidateLayers) { const layerWmsParams = layer.wmsParameters; // Add layer to the list of layers @@ -133,6 +134,9 @@ export default class Popup { if ('LEGEND_OFF' in layerWmsParams) { legendOff.push(layerWmsParams['LEGEND_OFF']); } + if (layer.layerConfig.popupMaxFeatures > popupMaxFeatures) { + popupMaxFeatures = layer.layerConfig.popupMaxFeatures; + } } const wms = new WMS(); @@ -151,9 +155,9 @@ export default class Popup { STYLE: layersStyles.join(','), CRS: mainLizmap.projection, BBOX: bbox, - FEATURE_COUNT: 10, WIDTH: width, HEIGHT: height, + FEATURE_COUNT: popupMaxFeatures, I: Math.round(xCoord), J: Math.round(yCoord), FI_POINT_TOLERANCE: pointTolerance, diff --git a/tests/end2end/playwright/popup.spec.js b/tests/end2end/playwright/popup.spec.js index 1e772575fd..deb969aac3 100644 --- a/tests/end2end/playwright/popup.spec.js +++ b/tests/end2end/playwright/popup.spec.js @@ -362,3 +362,20 @@ test.describe('Popup config mocked with "minidock" option', () => { await expect(page.locator('#mini-dock-content .lizmapPopupDiv')).toBeVisible(); }); }); + +test.describe('Popup max features', () => { + test('popupMaxFeatures param is respected', async ({ page }) => { + const url = '/index.php/view/map?repository=testsrepository&project=popup#-5.390390,35.762412,13.763671,50.710265|townhalls_pg|d%C3%A9faut|1'; + await gotoMap(url, page); + + await page.locator('#newOlMap').click({ + position: { + x: 435, + y: 292 + } + }); + + await expect(page.locator('.lizmapPopupSingleFeature')).toHaveCount(15); + }); +}); + diff --git a/tests/qgis-projects/tests/popup.qgs b/tests/qgis-projects/tests/popup.qgs index 51fa04d109..47a9fc73cb 100644 --- a/tests/qgis-projects/tests/popup.qgs +++ b/tests/qgis-projects/tests/popup.qgs @@ -1,4 +1,4 @@ - + @@ -20,6 +20,11 @@ + + + + + @@ -32,11 +37,13 @@ dnd_popup_3b9d335a_5491_45fa_8a8b_8dca1ca7ff3b + townhalls_pg_6c85c4bf_fe76_46b1_8445_0041d55d6e76 + @@ -72,6 +79,11 @@ + + + + \ No newline at end of file diff --git a/tests/qgis-projects/tests/popup.qgs.cfg b/tests/qgis-projects/tests/popup.qgs.cfg index 5775dab027..70216b46f5 100644 --- a/tests/qgis-projects/tests/popup.qgs.cfg +++ b/tests/qgis-projects/tests/popup.qgs.cfg @@ -1,16 +1,16 @@ { "metadata": { "qgis_desktop_version": 32815, - "lizmap_plugin_version_str": "4.3.12-alpha", - "lizmap_plugin_version": 40312, - "lizmap_web_client_target_version": 30800, + "lizmap_plugin_version_str": "4.3.17-alpha", + "lizmap_plugin_version": 40317, + "lizmap_web_client_target_version": 30900, "lizmap_web_client_target_status": "Dev", "instance_target_url": "http://localhost:8130/", - "instance_target_repository": "testsrepository" + "instance_target_repository": "intranet" }, "warnings": {}, "debug": { - "total_time": 0.7550000000000001 + "total_time": 0.36900000000000005 }, "options": { "projection": { @@ -29,10 +29,11 @@ 50000, 100000, 250000, - 500000 + 500000, + 5000000 ], "minScale": 10000, - "maxScale": 500000, + "maxScale": 5000000, "use_native_zoom_levels": false, "hide_numeric_scale_value": false, "initialExtent": [ @@ -55,6 +56,40 @@ "dataviz_drag_drop": [] }, "layers": { + "townhalls_pg": { + "id": "townhalls_pg_6c85c4bf_fe76_46b1_8445_0041d55d6e76", + "name": "townhalls_pg", + "type": "layer", + "geometryType": "point", + "extent": [ + 763818.7841061667, + 6274272.637559084, + 776574.4468899481, + 6286437.048030715 + ], + "crs": "EPSG:2154", + "title": "townhalls_pg", + "abstract": "", + "link": "", + "minScale": 1, + "maxScale": 1000000000000, + "toggled": "False", + "popup": "True", + "popupSource": "auto", + "popupTemplate": "", + "popupMaxFeatures": 15, + "popupDisplayChildren": "False", + "popup_allow_download": true, + "legend_image_option": "hide_at_startup", + "groupAsLayer": "False", + "baseLayer": "False", + "displayInLegend": "True", + "group_visibility": [], + "singleTile": "True", + "imageFormat": "image/png; mode=8bit", + "cached": "False", + "clientCacheExpiration": 300 + }, "children_layer": { "id": "children_layer_54bd162b_36b9_478e_811a_f56e9a15c36c", "name": "children_layer",