geosolutions-it / MapStore2

The solution to create and share maps, dashboards, geostories with 3D support on the web. And it is open-source too!
https://mapstore.geosolutionsgroup.com/
Other
515 stars 402 forks source link

"launchInfoPanel" option in search does not work with "showInMapPopup" #10669

Open tha-nordiq opened 1 week ago

tha-nordiq commented 1 week ago

Description

In embedded maps i want Identify to show as a popup with "showInMapPopup"

But the when i configure a search-service to "launchInfoPanel" the "FEATURE_INFO_CLICK" action is fired but then a subsequent "MAP:CLEAN_POPUPS" is fired that closes the popup

How to reproduce

Here is my pluginconfiguration for identify and search

                 {
                        "name": "Identify",
                        "cfg": {
                            "showInMapPopup": true,
                            "viewerOptions": {
                                "container": "{context.ReactSwipe}"
                            }
                        }
                    },
                    {
                        "name": "Search",
                        "cfg": {
                            "showOptions": false,
                            "withToggle": true,
                            "searchOptions": {
                                "services":[
                                {
                                    "type": "nominatim",
                                    "searchTextTemplate": "${properties.display_name}",
                                    "options": {
                                        "polygon_geojson": 1,
                                        "limit": 3,
                                        "typeName": "geosolutions:points"
                                    },
                                    "launchInfoPanel": true
                                }]
                            }
                        }
                    }

Expected Result "FEATURE_INFO_CLICK" is carried out and results are shown in a popup

Current Result "FEATURE_INFO_CLICK" is carried out but the popup is cleared with "MAP:CLEAN_POPUPS"

Other useful information

full html example

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Page with MapStore API</title>
        <link rel="preconnect" href="https://fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap" rel="stylesheet">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.css" />
        <link rel="shortcut icon" type="image/png" href="https://cdn.jslibs.mapstore2.geo-solutions.it/leaflet/favicon.ico" />
        <script src="https://maps.google.com/maps/api/js?v=3"></script>
        <!--script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.10/proj4.js"></script-->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.js"></script>
        <style>
        #container {
            position: absolute;
            top: 100px;
            left: 100px;
            right: 100px;
            bottom: 100px;
        }
        #mapstore2-embedded, #map, .fill {
            width: 100%;
            height: 100%;
        }
        </style>
    </head>
    <body onload="init()">
        <div id="container" class="ms2"></div>
        <script id="ms2-api" src="https://mapstore.geosolutionsgroup.com/mapstore/dist/ms2-api.js?v2024.02.00-stable"></script>
        <script type="text/javascript">
        function init() {
            MapStore2.create('container',{
                plugins: [
                'Map',
                    {
                        "name": "Identify",
                        "cfg": {
                            "showInMapPopup": true,
                            "viewerOptions": {
                                "container": "{context.ReactSwipe}"
                            }
                        }
                    },
                    {
                        "name": "Search",
                        "cfg": {
                            "showOptions": false,
                            "withToggle": true,
                            "searchOptions": {
                                "services":[
                                {
                                    "type": "nominatim",
                                    "searchTextTemplate": "${properties.display_name}", // text to use as searchText when an item is selected. Gets the result properties.
                                    "options": {
                                        "polygon_geojson": 1,
                                        "limit": 3,
                                        "typeName": "geosolutions:points"
                                    },
                                    "launchInfoPanel": true
                                }]
                            }
                        }
                    },
                    "OmniBar"

                ],
                configUrl: "https://mapstore.geosolutionsgroup.com/mapstore/rest/geostore/data/7903",
                originalUrl: "https://mapstore.geosolutionsgroup.com/mapstore/#/viewer/7903"
            });
        }
        </script>
    </body>
</html>