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.