Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix popup/tooltip issue in the featurelayer #65

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

gavinr
Copy link
Contributor

@gavinr gavinr commented Feb 9, 2023

Code fix from Esri/esri-leaflet#1350

Fixes #60 ... Note that the same issue with Leaflet 1.7 exists as here: Esri/esri-leaflet#1354

Code to test this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Esri Leaflet Debugging Sample</title>
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />

    <!-- load leaflet from cdn -->
    <link
      rel="stylesheet"
      href="https://unpkg.com/[email protected]/dist/leaflet.css"
    />
    <script src="https://unpkg.com/[email protected]"></script>

    <!-- load leaflet.markercluster from cdn -->
    <script src="https://unpkg.com/[email protected]/dist/leaflet.markercluster.js"></script>
    <link
      rel="stylesheet"
      href="https://unpkg.com/[email protected]/dist/MarkerCluster.css"
    />
    <link
      rel="stylesheet"
      href="https://unpkg.com/[email protected]/dist/MarkerCluster.Default.css"
    />

    <!-- load esri leaflet from cdn -->
    <script src="https://unpkg.com/esri-leaflet@3"></script>

    <!-- load clustered feature layer source for debugging -->
    <script src="../dist/esri-leaflet-cluster-debug.js"></script>

    <style>
      body {
        margin: 0;
        padding: 0;
      }

      #map {
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
      }

      #info-pane {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 400;
        padding: 1em;
        background: white;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <div id="info-pane" class="leaflet-bar">
      <label> sample application for debugging </label>
    </div>

    <script>

      var map = L.map("map").setView([45.526, -122.667], 6);

      L.esri.basemapLayer("Streets").addTo(map);

      var clusterLayer = L.esri.Cluster.featureLayer({
        url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0",
      }).addTo(map);

      clusterLayer.bindPopup(function (layer) {
        return L.Util.template("<p>{areaname}</p>", layer.feature.properties);
      });
    </script>
  </body>
</html>

@gavinr gavinr marked this pull request as ready for review February 9, 2023 18:53
@PedroVenancio
Copy link

Hi @patrickarlt and @gavinr
This should fix the issue.

Copy link
Contributor

@patrickarlt patrickarlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gavinr gavinr merged commit 413adf8 into Esri:master Feb 22, 2023
@gavinr gavinr deleted the 60-popup-fix branch February 22, 2023 18:54
@gavinr
Copy link
Contributor Author

gavinr commented Feb 23, 2023

This was released in v3.0.1.

@PedroVenancio
Copy link

Thank you very much @gavinr and @patrickarlt !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leaflet 1.9.3 error - can't access property "properties", layer.feature is undefined
4 participants