[openstreetmap/openstreetmap-website] Use MapLibre class extensions to DRY code (PR #6726)

Tom Hughes notifications at github.com
Mon Jan 19 20:48:46 UTC 2026


@tomhughes commented on this pull request.



> +    const rotationOptions = {};
+    if (allowRotation === false) {
+      Object.assign(rotationOptions, {
+        rollEnabled: false,
+        dragRotate: false,
+        pitchWithRotate: false,
+        bearingSnap: 180
+      });

> I would argue against API abstractions like this, since without any documentation how the code works this is otherwise reasonably hard to think about what is actually happening.

We can argue about the details of how it is implemented but I think the basic principle of not repeating the same code to initialise a map multiple times is good.

> This rails thingy with the weird not quite working imports where one never knows what code runs where and where it comes from is already a high bar, no need to be even more weird.

To be clear that's because we're using quite an old way of managing assets that works by textual inclusion/composition and a modern rails way of doing things would use ES6 imports and avoid the problems you're referring to.

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

Message ID: <openstreetmap/openstreetmap-website/pull/6726/review/3679586420 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260119/ff90bda8/attachment-0001.htm>


More information about the rails-dev mailing list