Page MenuHomePhabricator

Automatic zoom and positioning for geomasks in thumbnails broken again
Open, LowPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

  • The thumbnails are not zoomed in or positioned (however if you click into full view, they zoom and position correctly)

What should have happened instead?:

  • They should be zoomed in and centered on the masked area.

This was reported and fixed in T255932 but seems to have been broken again.

Event Timeline

This is most likely because of commit be2255928a9c3213309a1f52a134ef79f5a41d02 and the changes to autoposition.js by @Jgiannelos

This might also explain some of the other autoposition issues I've seen ppl mention here and there in the last 2 months.

So the new autoPosition.js does

var autobbox = bbox(data);
  var autoviewport = viewport(autobbox, [params.w, params.h])

But this does not account for when the elements do not fit, like the old one. They don't fit, because the first layer of the shapes is basically [ [ [ 3600, -180 ], [ 3600, 180 ], [ -3600, 180 ], [ -3600, -180 ], [ 3600, -180 ] ] ] as defined by wikimedia-mapdata.js / @wikimedia/mapdata. The old code would then slice this polygon from the first layer, if the elements did not fit.

This is a bit of a hack and apparently there were not testcases for it either.

Apparently this is still broken ?

Yes.

A small workaround while awaiting a fix, adding coordinates/frame coordinates to the mapframe parameters (I've only used the infobox template) fixes the display of the map in the frame.
The issue with labels showing outside the masked area also remains.

Also not autopositioning if multiple points are used on a thumbnail. See Module_talk:Mapframe#Second_point_does_not_show_up

Also not autopositioning if multiple points are used on a thumbnail. See Module_talk:Mapframe#Second_point_does_not_show_up

That's an onwiki issue with template/module that uses coordinates of the first point as map center coordinates and therefore avoids autopositioning. It expands to <mapframe ... latitude="54.491686111111" longitude="-3.5898555555556" .... This is perhaps some intentional but confusing and poorly documented template feature? It does seem to apply autopositioning if type1/id1/title1 parameters are used instead of type/id/title.