Skip to content

Commit

Permalink
More clear error message when trying to attach popup/tooltip to layer
Browse files Browse the repository at this point in the history
without getLatLng function
  • Loading branch information
johndoe committed Apr 23, 2019
1 parent 5c6c6e3 commit 7debbc9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/layer/DivOverlay.js
Expand Up @@ -173,7 +173,13 @@ export var DivOverlay = Layer.extend({
}

if (!latlng) {
latlng = layer.getCenter ? layer.getCenter() : layer.getLatLng();
if (layer.getCenter) {
latlng = layer.getCenter();
} else if (layer.getLatLng) {
latlng = layer.getLatLng();
} else {
throw new Error('Unable to get source layer LatLng.');
}
}

// set overlay source to this layer
Expand Down

0 comments on commit 7debbc9

Please sign in to comment.