<p></p>
<p><b>@tomhughes</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5443#discussion_r1899650484">app/assets/javascripts/index/new_note.js</a>:</p>
<pre style='color:#555'>> @@ -35,11 +35,13 @@ OSM.NewNote = function (map) {
OSM.router.route("/note/new");
});
- function createNote(marker, form, url) {
- var location = marker.getLatLng().wrap();
+ function createNote(form, url) {
+ if (!newNoteMarker) return;
</pre>
<p dir="auto">Why do we now need to check this? As far as I can see nothing has changed and if can be null now then it always could be?</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5443#discussion_r1899654095">app/assets/javascripts/index/new_note.js</a>:</p>
<pre style='color:#555'>> -
- halo = L.circleMarker(loc, {
- weight: 2.5,
- radius: 20,
- fillOpacity: 0.5,
- color: "#FF6200"
- });
+ function addHalo(latlng) {
+ if (halo) map.removeLayer(halo);
+ halo = L.circleMarker(latlng, {
+ weight: 2.5,
+ radius: 20,
+ fillOpacity: 0.5,
+ color: "#FF6200"
+ });
+ map.addLayer(halo);
</pre>
<p dir="auto">The vertical whitespace was there to make this more readable...</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5443#discussion_r1899655384">app/assets/javascripts/index/new_note.js</a>:</p>
<pre style='color:#555'>> @@ -130,11 +127,14 @@ OSM.NewNote = function (map) {
});
newNoteMarker.on("dragstart dragend", function (a) {
- newHalo(newNoteMarker.getLatLng(), a.type);
+ removeHalo();
+ if (a.type !== "dragstart") {
</pre>
<p dir="auto">Why not check for the type being <code class="notranslate">dragend</code> which would be much easier to reason about than having to find the set of captured events and then remove <code class="notranslate">dragstart</code> from that to work out when this is going to trigger?</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5443#discussion_r1899661113">test/system/create_note_test.rb</a>:</p>
<pre style='color:#555'>> @@ -24,4 +24,25 @@ class CreateNoteTest < ApplicationSystemTestCase
end
end
end
+
+ test "can open new note page when zoomed out" do
</pre>
<p dir="auto">Wouldn't it make more sense to start zoomed in and then test that things disable when you zoom out? It's more realistic than starting from a zoomed out URL which is something the site would never offer as the control is still disabled at low zoom.</p>
<p dir="auto">I mean there's nothing wrong with testing this, but we should test that zooming out triggers disablement as well.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5443#pullrequestreview-2525759939">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLP65Q5YT22PO7KXGNL2IFZEHAVCNFSM6AAAAABUGNR5IOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKMRVG42TSOJTHE">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOJLO2B25SQYKZO5VL2IFZEHA5CNFSM6AAAAABUGNR5IOWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTUWRQE4G.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5443/review/2525759939</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5443#pullrequestreview-2525759939",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5443#pullrequestreview-2525759939",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>