source: imaps-frontend/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 767 bytes
Line 
1import getBoundingClientRect from "./getBoundingClientRect.js"; // Returns the layout rect of an element relative to its offsetParent. Layout
2// means it doesn't take into account transforms.
3
4export default function getLayoutRect(element) {
5 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
6 // Fixes https://github.com/popperjs/popper-core/issues/1223
7
8 var width = element.offsetWidth;
9 var height = element.offsetHeight;
10
11 if (Math.abs(clientRect.width - width) <= 1) {
12 width = clientRect.width;
13 }
14
15 if (Math.abs(clientRect.height - height) <= 1) {
16 height = clientRect.height;
17 }
18
19 return {
20 x: element.offsetLeft,
21 y: element.offsetTop,
22 width: width,
23 height: height
24 };
25}
Note: See TracBrowser for help on using the repository browser.