Explorar o código

fixed "bottom" and "right" computing

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
9e2aea6406
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      lib/single-file/lazy-loader-before.js

+ 4 - 4
lib/single-file/lazy-loader-before.js

@@ -25,10 +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 : screen.height - boundingRect.height;
-		const left = (boundingRect.left > 0 && boundingRect.left < screen.width) ? boundingRect.left : screen.width - boundingRect.width;
-		const bottom = (boundingRect.bottom > 0 && boundingRect.bottom < screen.height) ? boundingRect.bottom : 0;
-		const right = (boundingRect.right > 0 && boundingRect.right < screen.width) ? boundingRect.right : 0;
+		const top = (boundingRect.top > 0 && boundingRect.top < screen.height) ? boundingRect.top : screen.height / 2;
+		const left = (boundingRect.left > 0 && boundingRect.left < screen.width) ? boundingRect.left : screen.width / 2;
+		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 };
 	};
 	dispatchEvent(new UIEvent("scroll"));