mediawiki-extensions-Popups/.storybook/helpers/grid.js
Noam Rosenthal 4492b54a44 Performance optimization for popup rendering
Reduce layout/style thrashing by measuring all required geometries
at event handler, not waiting for delays/redux/style changes.

Use CSS bottom instead of top, to avoid having to measure the popup
before positioning it, if it's placed above the link ("flippedY").

Disable some test cases that relied on implementation detail of using
"top" CSS.

Change-Id: Id0cbf506009b824d0fb6af4d6fe220e2f69aaaad
2020-11-30 17:33:07 +02:00

18 lines
344 B
JavaScript

/**
* Grid helper for absolutely positioning popups on page.
*/
const grid = {
landscape: {
row: ( x ) => 50 + ( ( x - 1 ) * 300 ),
col: ( x ) => 50 + ( ( x - 1 ) * 500 ),
flipOffset: 250
},
portrait: {
row: ( x ) => 50 + ( ( x - 1 ) * 450 ),
col: ( x ) => 50 + ( ( x - 1 ) * 400 ),
flipOffset: 400
},
}
export default grid;