|
|
@@ -25,8 +25,10 @@
|
|
|
window._singleFile_getBoundingClientRect = Element.prototype.getBoundingClientRect;
|
|
|
Element.prototype.getBoundingClientRect = function () {
|
|
|
const boundingRect = window._singleFile_getBoundingClientRect.call(this);
|
|
|
- const top = (boundingRect.top > 0 && boundingRect.top < screen.height) ? boundingRect.top : Math.floor(screen.height / 2);
|
|
|
- const left = (boundingRect.left > 0 && boundingRect.left < screen.width) ? boundingRect.left : Math.floor(screen.width / 2);
|
|
|
+ const quarterLeft = Math.floor(screen.width / 4);
|
|
|
+ const quarterTop = Math.floor(screen.height / 4);
|
|
|
+ const top = (boundingRect.top > 0 && boundingRect.top < screen.height) ? boundingRect.top : boundingRect.top > screen.height ? screen.height - quarterTop : quarterTop;
|
|
|
+ const left = (boundingRect.left > 0 && boundingRect.left < screen.width) ? boundingRect.left : boundingRect.left > screen.width ? screen.width - quarterLeft : quarterLeft;
|
|
|
const bottom = top + boundingRect.height;
|
|
|
const right = left + boundingRect.width;
|
|
|
return { x: boundingRect.x, y: boundingRect.y, top, bottom, left, right, width: boundingRect.width, height: boundingRect.height };
|