[openstreetmap/openstreetmap-website] Fixed displacing points specified from context menu (PR #4904)

David Tsiklauri notifications at github.com
Thu Aug 8 09:20:44 UTC 2024


@nertc commented on this pull request.

Everything I tested, worked perfectly. This is just recommendation for less code to be written.

> @@ -5,6 +5,7 @@
 OSM.Directions = function (map) {
   var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back
   var chosenEngine;
+  var coordinatesRegularExpression = "([+-]?\\d+(\\.\\d*)?)(?:\\s+|\\s*[/,]\\s*)([+-]?\\d+(\\.\\d*)?)";

To avoid `new RegExp("^" + coordinatesRegularExpression + "$")` every time we use this variable, you can define it as `var coordinatesRegularExpression = /^([+-]?\d+(\.\d*)?)(?:\s+|\s*[\/,]\s*)([+-]?\d+(\.\d*)?)$/;` and it will automatically be regexp.

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

Message ID: <openstreetmap/openstreetmap-website/pull/4904/review/2226972310 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240808/f7a6e686/attachment.htm>


More information about the rails-dev mailing list