[openstreetmap/openstreetmap-website] Add 'canDownloadImage' layer option (PR #5416)
Holger Jeromin
notifications at github.com
Thu Dec 19 10:14:15 UTC 2024
@HolgerJeromin commented on this pull request.
> @@ -411,34 +416,20 @@ L.OSM.share = function (options) {
$("#mapnik_image_width").text(mapWidth);
$("#mapnik_image_height").text(mapHeight);
- const layerId = map.getMapBaseLayerId();
- const layerKeys = new Map([
- ["mapnik", "standard"],
- ["cyclemap", "cycle_map"],
- ["transportmap", "transport_map"]
- ]);
+ const canDownloadImage = layer && layer.options.canDownloadImage;
```suggestion
const canDownloadImage = !!(layer && layer.options.canDownloadImage);
```
or
```suggestion
const canDownloadImage = Boolean(layer && layer.options.canDownloadImage);
```
[Modern js](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing) would be (available across browsers since September 2020):
```suggestion
const canDownloadImage = layer?.options.canDownloadImage ?? false;
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5416#discussion_r1891553543
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5416/review/2513975945 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241219/12946bb6/attachment-0001.htm>
More information about the rails-dev
mailing list