[openstreetmap/openstreetmap-website] Add 'canDownloadImage' layer option (PR #5416)

Tom Hughes notifications at github.com
Thu Dec 19 08:57:22 UTC 2024


@tomhughes requested changes 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;

This doesn't guarantee a boolean valued result - specifically if the `canDownloadImage` key is missing then the result is `undefined` not `false` and at least in Firefox calling `toggle(undefined)` toggles the current visibility instead of always hiding the element though I don't think the behaviour is defined at all by jQuery.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5416#pullrequestreview-2513743852
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5416/review/2513743852 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241219/9aebbef4/attachment.htm>


More information about the rails-dev mailing list