tyrasd left a comment (openstreetmap/openstreetmap-website#5698)

ehrm… 

Given that:
* `mapParams.center/.zoom` get the location via different means (either via the 
URL's hash, `mlat/mlon` query parameters or the previously last visited 
location that's stored in a cookie)
* iD will not auto-center to a the supplied osm features if a `#map=…` 
parameter is present

The expected behavior is that:
* if iD is loaded via a link that only has a map object (e.g. 
`osm.org/edit?node=1`, or `osm.org/edit?note=1234`), the editor should 
auto-center to the respective object during startup
* if iD is loaded via a link that has both a map object and a map hash (e.g. 
`osm.org/edit?node=1#map=0/0/0`), it should set the map to the given 
lat/lon/zoom values
* if iD is loaded via a bare link (`osm.org/edit`), it should use the map view 
that is stored in the cookie

So… since `mapParams` should already have the information from the `hashArgs`, 
I guess it should be able to reduce the inner `if` to something like the 
following, is that what you mean by _Removing the `else`_??

```js
    if (!hashArgs.center) {
      setMapView = false;
    };
```

I just tried to keep the fix here to the bare minimum and didn't want to touch 
the rest of the logic…

PS: if I see this correctly, `idData.lat/.lon` are only set when the editor is 
loaded using a `…?note=xxx` link, see 6494747882358cc1506ae442c89eed3db1de94a4. 
This is AFAICT not necessary anymore because notes are by now also using the 
`mapParams.object` path. But let's handle that in another PR, shall we?

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

Message ID: 
<openstreetmap/openstreetmap-website/pull/5698/c2663920...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to