I've noticed that the image previews in Hovercards ('Popups' extension) do not respect high-density displays and can end up a little blurry because of this.
While patching the extension, someone recommended to me to bracket the detected density to the values we use for default thumb generation on the wiki (the 1, 1.5, and 2x densities we specify in 'srcset' attribute on <img>s), so browsers that are zoomed slightly off from default or devices that are not quite on the most common densities don't force extra thumbnail renders.
Do folks have any preference for whether I should add that as a separate function like $.bracketedDevicePixelRatio() or just directly bracket the output of the $.devicePixelRatio wrapper function?
A quick look at code using $.devicePixelRatio() indicates most uses are multiplying an image size to get a thumbnail, so that might be convenient but I don't want to cause surprises. ;)
Task: https://phabricator.wikimedia.org/T97935 Core patch: https://gerrit.wikimedia.org/r/#/c/208820/ Hovercards patch: https://gerrit.wikimedia.org/r/#/c/208515/
Current version of the patch adds a separate $.bracketedDevicePixelRatio().
-- brion
On Tue, May 5, 2015 at 3:20 AM, Brion Vibber bvibber@wikimedia.org wrote:
Do folks have any preference for whether I should add that as a separate function like $.bracketedDevicePixelRatio() or just directly bracket the output of the $.devicePixelRatio wrapper function?
$.bracketedDevicePixelRatio() as a separate function, please :)
Even though most uses of $.devicePixelRatio() are to get thumbnail sizes (as you noted), I don't think we should change the existing functionality. Adding a separate method seems easy enough [1] and won't break cases where its being used for UI calculations.
—prtksxna
[1] as I can see in https://gerrit.wikimedia.org/r/#/c/208820/
As stated on the bug I'd like us to get to a point where we don't have to think about this. Ideally a JavaScript dev should be able to create an oojs ui image element that is compatible with this. A server side function should also exist for creating this. On 6 May 2015 6:57 am, "Prateek Saxena" psaxena@wikimedia.org wrote:
On Tue, May 5, 2015 at 3:20 AM, Brion Vibber bvibber@wikimedia.org wrote:
Do folks have any preference for whether I should add that as a separate function like $.bracketedDevicePixelRatio() or just directly bracket the output of the $.devicePixelRatio wrapper function?
$.bracketedDevicePixelRatio() as a separate function, please :)
Even though most uses of $.devicePixelRatio() are to get thumbnail sizes (as you noted), I don't think we should change the existing functionality. Adding a separate method seems easy enough [1] and won't break cases where its being used for UI calculations.
—prtksxna
[1] as I can see in https://gerrit.wikimedia.org/r/#/c/208820/
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Wed, May 6, 2015 at 2:29 AM, Jon Robson jdlrobson@gmail.com wrote:
As stated on the bug I'd like us to get to a point where we don't have to think about this. Ideally a JavaScript dev should be able to create an oojs ui image element that is compatible with this. A server side function should also exist for creating this.
Ooh sounds like now I have a project. :D
On 6 May 2015 6:57 am, "Prateek Saxena" psaxena@wikimedia.org wrote:
On Tue, May 5, 2015 at 3:20 AM, Brion Vibber bvibber@wikimedia.org wrote:
Do folks have any preference for whether I should add that as a
separate
function like $.bracketedDevicePixelRatio() or just directly bracket
the
output of the $.devicePixelRatio wrapper function?
$.bracketedDevicePixelRatio() as a separate function, please :)
Even though most uses of $.devicePixelRatio() are to get thumbnail sizes (as you noted), I don't think we should change the existing functionality. Adding a separate method seems easy enough [1] and won't break cases where its being used for UI calculations.
Excellent...
-- brion
—prtksxna
[1] as I can see in https://gerrit.wikimedia.org/r/#/c/208820/
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org