Page MenuHomePhabricator

PAGEBANNER "origin" parameter calculation is not working at all.
Closed, ResolvedPublic

Description

Hello,
I have noticed that PAGEBANNER doesn't change the banner position if origin is inserted. I have tested it in other wikis and the result is the same, but I would like it to be solved in euwiki if possible.

Event Timeline

@Theklan can you provide some more information? The origin only sets a central focal point so it completely depends on the image resolution and the device you are using whether the result is the same. Can you point us to an example?

You can use my sandbox: https://eu.wikipedia.org/wiki/Lankide:Theklan/Proba_orria

Now the code is {{PAGEBANNER:FakeRealLogSpiral.svg|origin=-1,-1}}

It should be positioned bottom left, but it's not even center center.

Jdlrobson renamed this task from PAGEBANNER is not calculating "origin" parameter in euwiki to PAGEBANNER "origin" parameter calculation is misleading/confusing.Apr 10 2018, 6:33 PM

This looks like it's working as it's currently implemented - I've documented it to the best of my ability here: https://www.mediawiki.org/wiki/Extension:WikidataPageBanner#origin_parameter
It's not very intuitive. Ideally it would be editable via a graphical interface. In terms of your particular problem, I'd suggest creating a copy of the image with whitespace inside the image itself, above/to the sides of the image.

No, the vertical reposition is not happening. The result is the same if you put 1, 0 or -1. So the solution can't be creating a new image (for that, I would make all of them "banner-sized".

Note that if you put origin 1, 0 or -1 (or any other) the css makes, via jquery, a reposition to "top: -XXXXpx", independent of the image shape, being XXXX dependant on the width of the screen, and not the image.

So, inserting 0,0 should be a fully centered image, and it's not.

Theklan renamed this task from PAGEBANNER "origin" parameter calculation is misleading/confusing to PAGEBANNER "origin" parameter calculation is not working at all..Apr 10 2018, 7:06 PM

"it's not working at all" is not accurate. It's doing something, but it's rules are not clear at all.

Playing with it an image of Albert Einstein I do see an impact on https://eu.m.wikipedia.org/wiki/Lankide:Jdlrobson/Draft

With origin |origin=0.125,-0.5

Screen Shot 2018-04-10 at 12.11.45 PM.png (309×766 px, 251 KB)

With no origin:

Screen Shot 2018-04-10 at 12.11.49 PM.png (314×762 px, 234 KB)

The code appears to be written to make minor corrections to the central focal point, rather than to make major changes Sadly the code is not well documented, tested and in need of a lot of love.
I

With origin |origin=0.125,-0.5 and with origin |origin=-0.9,0.8 does exactly the same. So it doesn't work at all.

The same result with |origin=0.125,0.3 and with |origin=-0.125,-0.3

irudia.png (300×1 px, 729 KB)

If you insert "origin", then yes, it does something... but it's not what it was expected.

It seems that the problem is in jquery, with deprecated calls.

Change 471290 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/WikidataPageBanner@master] Allow banner debugging via debug-banner=true

https://gerrit.wikimedia.org/r/471290

Change 471290 abandoned by Jdlrobson:
Allow banner debugging via debug-banner=true

Reason:
not working on it

https://gerrit.wikimedia.org/r/471290

I'm confused about what the desired coordinate system is meant to be:

  • the wiki page says that the top left corner is 1,1;
  • T108785 says it's -1,-1;
  • and the image in T108785 (F1346569) says -1,1.

I suspect the latter is what it's supposed to be, given that is most normal (assuming it's not doing the web browser thing of the origin being at top left of the screen and the Y value going up as you go down the screen). I made a diagram for it: https://commons.wikimedia.org/wiki/File:WikidataPageBanner_coordinates,_portrait.svg

It looks like the calculations are not being done correctly, at least for the top offset.

Change 723805 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikidataPageBanner@master] Recaculate the Y-offset

https://gerrit.wikimedia.org/r/723805

Change 723805 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] Refine the offset margin calculation

https://gerrit.wikimedia.org/r/723805

Change 730368 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikidataPageBanner@REL1_36] Refine the offset margin calculation

https://gerrit.wikimedia.org/r/730368

The docs are fixed, as is the code. The origin parameter should now work correctly.

Will leave this open till the fix is in production and confirmed.

Change 730368 abandoned by Samwilson:

[mediawiki/extensions/WikidataPageBanner@REL1_36] Refine the offset margin calculation

Reason:

It's errors like this that make me wish we could run CI on all of an extension's supported versions, before merging a change! But anyway, it's not crucial to get this into 1.36 so I'm not going to bother.

https://gerrit.wikimedia.org/r/730368

Tacsipacsi subscribed.

@Samwilson The patch is long deployed in production. Can you please check it and close if fixed? It’s not clear for me what the result should be, so I’d like not to judge it.

Samwilson claimed this task.

Yep, it looks like this is fixed (test). Thanks for reminding me!